home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Folder_loc2070916152007.psc / clsDenyAccess.cls < prev    next >
Text File  |  2007-06-15  |  1KB  |  38 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "clsDenyAccess"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
  15. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  16.  
  17. Const OFS_MAXPATHNAME = 128
  18. Const OF_CREATE = &H1000
  19. Const OF_READ = &H0
  20. Const OF_WRITE = &H1
  21. Private Type OFSTRUCT
  22.         cBytes As Byte
  23.         fFixedDisk As Byte
  24.         nErrCode As Integer
  25.         Reserved1 As Integer
  26.         Reserved2 As Integer
  27.         szPathName(OFS_MAXPATHNAME) As Byte
  28. End Type
  29. Dim m_Hwnd As Long
  30. Public Sub DenyAccess(sFolder As String)
  31. Dim OF As OFSTRUCT
  32. m_Hwnd = OpenFile(sFolder & "\Protect.dat", OF, OF_READ)
  33. End Sub
  34. Public Sub AllowAccess()
  35. CloseHandle m_Hwnd
  36. m_Hwnd = 0
  37. End Sub
  38.