Code:
Private Declare Function APIssinUserDLL_MsgBox Lib "user32" Alias "MessageBoxA" (Optional ByVal hWnd As Long, Optional ByVal Prompt As String, Optional ByVal Title As String, Optional ByVal Buts As Long) As Long '
.
Code:
Private Declare Function SetWindowsHooksExample Lib "user32" Alias "SetWindowsHookExA" (ByVal Hooktype As Long, ByVal lokprocedureAddress As Long, Optional ByVal hmod As Long, Optional ByVal DaFredId As Long) As Long
' The effect of this will be: In some predetermined set of instructions or planned chain of events
, a “hook” or “marker” or “clap trap” or “page marker” or “trip trap” was made. This was given an identifying number which was returned by
that “API Function” and it was chosen to be placed in the main code in a globial variable hHookTrapCrapNumber.
I do not think that this number identifies the “page in the book” where the bookmarker is.
I think it just is listed somewhere in a list of any active / set up book marks. I guess there might be / could be a few, so you need to distinguish them.
Private hHookTrapCrapNumber As Long ' "BookmarkClassNumber --- This makes pseudo
Declare Sub() SetWindowsHooksExample Lib "user32" AliAs "SetWindowsHookExA" (ByVal hHookTrapCrapNumber As Long, ByVal Hooktype As Long, ByVal MyloksPROCedureFukAddress As Long, Optional ByVal RadioButton2Out As Long, Optional ByVal duhFredId As Long) As Long
It was also disgussed that possibly the number refers to set instances of a Bookmark class: there may be a few ,
but they are all effectively connected / activated by the number hHookTrapCrapNumber existing in some register.
The bookmarker has a particular type, ( 5 ). The type will be responsible for catching the Message box code line to call the MessageBoxA,
(like APIssinUserDLL_MsgBox &H0, "Select Range", "working ApplicationPromptToRangeInputBox", vbYesNoCancel ).
That fires my hook PROCedure Function, WinSubWinCls_JerkBackOffHooKterd.
Other things may also fire my hook PROCedure Function. They may or may not be also related to the Popping up of my Box.
' Dim BookMarkClassTeachMeWind As Long: Let BookMarkClassTeachMeWind = 5 ' 5 is Hooktype that I will be using. Using a variable for two reasons: '1_- general point in computing that you might get problems when a number is used to refer to something that might take or give a number at some point. But you might need to do that, so having an intermediate word is a workaround for that so that the number is set to a word which is then related to a word that might be being referred to or returning a number. Function = Word --- Word = 873248 '2_- Just to avoid confusion Later as in this particular case later another option number happens to be 5
Private Declare Function GetDaFredId Lib "kernel32" Alias "GetCurrentThreadId" () As Long ' The Thread is what is going on,
I expect that means in this case my VBA. My computer might do something else with or without me knowing. Most things going on will have a Thread number.
When used in my code, Function GetDaFredId will return an identifying number referring to the Excel instance that that code line is in.
It is actually needed in the setting of the Windows hook code line only ( that which is last argument in SetWindowsHookEx( , , , DaFredId As Long) ...
..set a hook, confined to the current thread (so it doesn't get triggered by other things going on) and give it the address of the function that you want to call in response to the hook being triggered. In this I will use 5 CBT hook which is triggered generally by Window messages (activating, creating, destroying, minimizing, maximizing, moving, or sizing a window)
' This below takes it off the chain. Or wipe the chain clean. Or remove it from something. Or cancel it. Or Kill it. Or whatever.
In any case it needs the identifying number of the "hook", then a simple code line as shown in comment below will do this "Killing"
Without doing this the thing seems to go on indefinitely (with or without any recursion. (A recursion is another issue which seems to happen as an additional issue - that occurs when the final API code below (over next line) does its job - that seems to fire my Hook PROCedure function WinSubWinCls_JerkBackOffHooKterd
Private Declare Function UnHookWindowsHookCodEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHookTrapCrapNumber As Long) As Long ' 'Release the Hook This is used in code in a simple code line like:- Call UnHookWindowsHookCodEx(hHookTrapCrapNumber)
Code:
Private Declare Function SetWindowPosition Lib "user32" Alias "SetWindowPos" (ByVal hWnd As Long, ByVal zNumber As Long, ByVal CoedX As Long, ByVal CoedY As Long, ByVal xPiXel As Long, ByVal yPiYel As Long, ByVal wFlags As Long) As Long
' This API prog will be called in my hook PROCedure function.
So.. Rem 2a)-c) sets "Bookmark"/ series of "Bookmarks"/ Microsoft Windows cyber Robot monitering events (of "type 5", i.e. my Pop up coming up is one such.
When such a event occurs my function is triggered by Windows software monitering Robot, he knows where/which my function WinSubWinCls_JerkBackOffHooKterd is from the AddressOf in a "hook setting code line" like
(5 ,AddressOf WinSubWinCls_JerkBackOffHooKterd , 0, ThreadID)
The monitering Robot program thing passes somehow (a number from a list of event types to tell me more precisely what event it noticed, wParam-identifying number of the Window doing that event, possibly some other mouse thing info thing am not bothered about)
Code:
Dim Booloks As Boolean ' I use this in the code line Booloks = SetWindowPosition(WindowIdentifyinghandle, zorder,x, y, width, height ,zFurtherInfo)
I don't seem to need this, but as a function, the SetWindowPos is designed to return a value. In this usage I have not experienced problems using it as a Sub routine Call like Call SetWindowPosition( , , , , , , ) but to be on the safe side I have used it as a Function returning its return in a Boolean variable, Booloks
Dim GlobinalCntChopsLog As Long ' I use this to keep track of the copy number of my Hook PROCedure function WinSubWinCls_JerkBackOffHooKterd, that is to say check for when that = 2. If that is the case I do the "unhooking" and Exit the Function
' ========================
Bookmarks