J
Jules
I'm attempting to use VB to provide a list of installed printers on a
users PC. The code is from a textbook and I get no errors whilst
writing it, but when it is run I get a COMPILE ERROR at the Declaring
API functions. The Compile Error is "Only comments may appear after
End Sub, End Funtion, or End Property. Might be too many hours sat in
front of a screen but I can't see it. (Using Windows and Office XP)
Code follows:-
'1st, declare constants
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const SUCCESS = 0&
'2nd, declare custom data type
Type FileTime
dwLowDateTime As Long
dwhighDateTime As Long
End Type
'3rd, declare API functions
'**** Error hightlight the following text
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hkey As Long, ByVal lpsubkey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, _
phkResult As Long) As Long
Declare Function regEnumKeyEx Lib "advapi32.dll" Alias _
"regEnumKeyExA" (ByVal hkey As Long, ByVal dwIndex As _
Long, ByVal lpname As String, lpcbName As Long, ByVal _
lpreserved As ong, ByVal lpClass As String, lpcbClass _
As Long, lpftLastWriteTime As FileName) As Long
Declare Function regCloseKey Lib "advapi32.dll" _
(ByVal hkey As Long) As Long
users PC. The code is from a textbook and I get no errors whilst
writing it, but when it is run I get a COMPILE ERROR at the Declaring
API functions. The Compile Error is "Only comments may appear after
End Sub, End Funtion, or End Property. Might be too many hours sat in
front of a screen but I can't see it. (Using Windows and Office XP)
Code follows:-
'1st, declare constants
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const SUCCESS = 0&
'2nd, declare custom data type
Type FileTime
dwLowDateTime As Long
dwhighDateTime As Long
End Type
'3rd, declare API functions
'**** Error hightlight the following text
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hkey As Long, ByVal lpsubkey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, _
phkResult As Long) As Long
Declare Function regEnumKeyEx Lib "advapi32.dll" Alias _
"regEnumKeyExA" (ByVal hkey As Long, ByVal dwIndex As _
Long, ByVal lpname As String, lpcbName As Long, ByVal _
lpreserved As ong, ByVal lpClass As String, lpcbClass _
As Long, lpftLastWriteTime As FileName) As Long
Declare Function regCloseKey Lib "advapi32.dll" _
(ByVal hkey As Long) As Long