|
-
March 26th, 2001, 09:06 PM
#1
why didnt work
hi,
Is the following statement correct?
Declare Function CreateFile Lib "Kernel32" Alias "CreateFileA" (byval lpFileName as string, byval dwDesiredAccess as Long, byval dwShareMode as Long, lpSecurityAttributes as SECURITY_ATTRIBUTES, byval dwCreationDisposition as Long, byval dwFlagsAndAttributes as Long, byval hTemplateFile as Long) as Long
Type SECURITY_ATTRIBUTES
nLength as Long
lpSecurityDescriptor as Long
bInheritHandle as Long
End Type
Dim sec as SECURITY_ATTRIBUTES
Dim hDevice as Long
hDevice = CreateFile ("\\.\MyHook.vxd", 0, 0, sec, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE,0)
I do not understand why it is unable to get the handle of a VXD file which I created. But in VC++ using the same function, I am able to get it.
Hope someone can help.
Thanks
-
March 27th, 2001, 12:33 AM
#2
Re: why didnt work
Without trying it, I would say you may need to declare your SECURITY_ATTRIBUTES as byval.
Just a thought.
--Joey
-
March 27th, 2001, 03:09 AM
#3
Re: why didnt work
To find out why an API call failed use:
'\\ -- [ LastSystemError ]------------------------------------------------------------------
'\\ Returns the message from the system which describes the last dll error to occur, as
'\\ held in Err.LastDllError. This function should be called as soon after the API call
'\\ which might have errored, as this member can be reset to zero by subsequent API calls.
'\\ ----------------------------------------------------------------------------------------
'\\ You have a royalty free right to use, reproduce, modify, publish and mess with this code
'\\ I'd like you to visit http://www.merrioncomputing.com for updates, but won't force you
'\\ ----------------------------------------------------------------------------------------
public Function LastSystemError() as string
Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000
Dim sError as string * 500 '\\ Preinitilise a string buffer to put any error message into
Dim lErrNum as Long
Dim lErrMsg as Long
lErrNum = Err.LastDllError
lErrMsg = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, byval 0&, lErrNum, 0, sError, len(sError), 0)
LastSystemError = Trim(sError)
End Function
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|