1 Attachment(s)
LB_GETCOUNT (Megatron, RobDog, MartinLiss)
Martin will you please delete the other post of mine with this title -- I could not delete.
----------------------
Attached is a program I'm working on to correct Microsofts Toolbar Customize Method.
For some reason LB_GETCOUNT will not return a count?
Any ideas or other approached appreciated?
Thanks
David
Re: LB_GETCOUNT (Megatron, RobDog, MartinLiss)
Thanks for response Megatron.
Will modifiy code with your post.
Had planned to try and track the message stream this weekend and well as hopefully implement WH_GETMESSAGE for tbr.Customize from a menu.
Quote:
there is a customized message being sent indirectly
Not sure what you mean by the above?
Are you referring to the parent (container) child relationship of the toolbar?
David
Re: LB_GETCOUNT (Megatron, RobDog, MartinLiss)
Still fighting this. You probably have looked at this yourself, but if not:
********* Message Stream
'----- Mouse entered Toolbar
<00043> 0000026C S WM_MOUSEACTIVATE hwndTopLevel:00000278 nHittest:HTCLIENT uMsg:WM_LBUTTONDOWN [wParam:00000278 lParam:02010001]
<00044> 0000026C R WM_MOUSEACTIVATE fuActivate:MA_ACTIVATE
<00045> 0000026C S WM_SETCURSOR hwnd:0000026C nHittest:HTCLIENT wMouseMsg:WM_LBUTTONDOWN [wParam:0000026C lParam:02010001]
<00046> 0000026C R WM_SETCURSOR fHaltProcessing:False
'------ Clicked Toolbar
<00047> 0000026C P WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:258 yPos:17 [wParam:00000001 lParam:00110102 time:1:41:26.915]
<00048> 0000026C S WM_SETCURSOR hwnd:0000026C nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE [wParam:0000026C lParam:02000001]
<00049> 0000026C R WM_SETCURSOR fHaltProcessing:False
<00050> 0000026C P WM_MOUSEMOVE fwKeys:0000 xPos:258 yPos:17 [wParam:00000000 lParam:00110102 time:1:41:27.017]
<00051> 0000026C S WM_MOUSEACTIVATE hwndTopLevel:00000278 nHittest:HTCLIENT uMsg:WM_LBUTTONDOWN [wParam:00000278 lParam:02010001]
<00052> 0000026C R WM_MOUSEACTIVATE fuActivate:MA_ACTIVATE
<00053> 0000026C S WM_SETCURSOR hwnd:0000026C nHittest:HTCLIENT wMouseMsg:WM_LBUTTONDOWN [wParam:0000026C lParam:02010001]
<00054> 0000026C R WM_SETCURSOR fHaltProcessing:False
<00055> 0000026C P WM_LBUTTONDBLCLK fwKeys:MK_LBUTTON xPos:258 yPos:17 [wParam:00000001 lParam:00110102 time:1:41:27.115]
Re: LB_GETCOUNT (Megatron, RobDog, MartinLiss)
Quote:
Originally Posted by dw85745
Not sure what you mean by the above?
Are you referring to the parent (container) child relationship of the toolbar?
David
Yes. Inside the toolbar, there is another window that's processes double-click messages into invoking the "Customize" method, hence the reason why sending messages to the actual toolbar, itself, will not work, because we want to send to the internal window (not the parent window).
The code I supplied earlier will get the handle of this internal window. Send your mouse-events to it, and the customize dialog should appear.
Re: LB_GETCOUNT (Megatron, RobDog, MartinLiss)
Have tried all three differerent classes that have shown up below:
VB Code:
Private Sub DBLClickToolbar()
'Get the Form Handle
hForm = FindWindow(vbNullString, "howto_hidden_toolbar_buttons")
If hForm Then
'Get the Toolbar Handle
hToolbar = FindWindowEx(tbrActions.hwnd, 0, "msvb_lib_toolbar", vbNullString)
' hToolbar = FindWindowEx(hForm, 0, "Toolbar20WndClass", vbNullString)
' hToolbar = FindWindowEx(hForm, 0, "ToolbarWindow32", vbNullString)
If hToolbar Then
Whatever ..............
End Sub
Re: LB_GETCOUNT (Megatron, RobDog, MartinLiss)
Yes, "msvb_lib_toolbar" is the one you want.
Send your messages to that window, and the customize dialog will be displayed.
Re: LB_GETCOUNT (Megatron, RobDog, MartinLiss)
Been working on this toolbar problem on and off all week with an HCBT hook.
Not working.
QUESTIONS
Before I abandon HCBT and look at HGETMESSAGE can you explain
how you decide which HOOK to use, or is this trial/error and experience?
Do you know any place (SDK does NOT give the detail I want) that would provide specific information such as below for each of the 15 hook types.
****************************
My assessment for the toolbar would be:
1. Try and hook when the buttons are being created and/or placed
into the listboxes so that I could redirect them to the listbox of choice.
My guess is that the buttons would be added AFTER the customize form
as well as the listboxes exist, but before ShowWindow.
Based on the following HCBT does not appear to allow me to hook into where I need to hook. Here's what I've determined with HCBT.
Re: HCBT_CREATEWND
-----------------
I can get each Class hwnd, and Class name on the
Customize form, BUT at this point the text of the
control (such as "Reset") is NOT available other than through
the CREATEWND structure.
---> My conclusion is that HCBT_CREATEWND hooks just after class and window creation. BUT SINCE THE BUTTONS ARE ADDED AFTER CREATION
BUT BEFORE ACTIVATION, do I need to do this by looking for each Button being put into the listbox??? Tried by AddExtraButton routine here but
keep locking up.
------------------
For example:
HCBT_CREATEWND
Button 1796 --> Debug.Print Left$(lpClassName, 15); wParam
"" --> GetWindowText
HCBT_CREATEWND
Button 1800
""
HCBT_CREATEWND
Static 1804
""
HCBT_CREATEWND
ListBox 1808
""
Re: HCBT_ACTIVATE
---------------
This just returns the "Customize" Form and "Form1"
My conclusion here is that this hooks just before ShowWindow.
---> You would think this would be a good place to modify the Customize form
but so far my attempts have yielded "Method Customizee of object IToolbar failed"
and a lockup.
---------------
HCBT_ACTIVATE
#32770 1780 --> Debug.Print Left$(lpClassName, 15); wParam
Customize Toolbar --> GetWindowText
HCBT_ACTIVATE
ThunderForm 1752
howto_hidden_toolbar_buttons
******************************
Re: LB_GETCOUNT (Megatron, RobDog, MartinLiss)
I, personally, like use WH_GETMESSAGE, but if you're using a WH_CBT (Computer based training, FYI) hook, you're interested in the HCBT_CREATEWND notification. This will be sent just prior to the window creation.
And you're right: Chances are, the buttons have not even been created yet (the window, itself, isn't created yet) so you won't be able to get their handles at this point. All buttons are probably be created in the WM_CREATE event of the parent window, so it's safe to obtain handles for these buttons in the WM_ACTIVATE event. In order to gain access to this event, subclass the window.
Each time a button is clicked, it sends a WM_COMMAND message to the parent form, with the lParam parameter containing the handle of the button pressed, and the high-order bits containing a BN_CLICKED notification code. Catch these, and you should be good to go.
What is it you're trying to do again? Check when a specific button is clicked?