|
-
March 27th, 2001, 01:53 AM
#1
UnhookWindowsHookEx
Is there a way to check whether the API UnhookWindowsHookEx() is true ?
-
March 27th, 2001, 03:07 AM
#2
Re: UnhookWindowsHookEx
It returns the previous hook id (positive number) or zero on success. It sets Err.LastDLLError on failure.
To decode the failure reason:
'\\ -- [ 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
and an example of how this is used...
public Sub StopHook(byval HookType as enHookTypes)
Dim lret as Long
'\\ If a hook of this type is already set, unhook this first
If HookIdByType(HookType) > 0 then
lret = UnhookWindowsHookEx(HookIdByType(HookType))
If Err.LastDllError > 0 then
Call ReportError(Err.LastDllError, "EnumHandler:StopHook", APIDispenser.LastSystemError)
End If
End If
End Sub
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
-
March 27th, 2001, 08:13 AM
#3
Re: UnhookWindowsHookEx
Sorry if i did not make myself clear. Actually , i just want to detect see if this UnhookWindowsHookEx API has occurred . Do you have any suggestions on this ? 
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
|