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?
Re: LB_GETCOUNT (Megatron, RobDog, MartinLiss)
Still plan to look at WH_GETMESSAGE hook once I finish understanding CBT.
----------------------------------------------------------
What is it you're trying to do again? Check when a specific button is clicked?
----------------------------------------------------------
With the Hook, I am looking at another approach to acccomplish the objective -- if I can do what I want.
PREVIOUSLY:
1) We were able to load new buttons and transfer them from the right to the left listbox so the buttons would be available. This worked with a DoubleClick but NOT with the Toolbar.Customize Method.
2) There was NO way to save the configuration for loading during startup.
NOW:
1) HCBT_DESTROYWND will allow the saving of the button configuration for use during startup.
2). Struggling with trying to get the buttons loaded both with a DoubleClick and Toolbar.Customize Method.
My THOUGHT is that it might be easier to load the buttons directly into the Right and Left Listbox rather than messing around with sending messages to various buttons.
---> The QUESTION is can I load directly to the listbox (takes both text and icons) and bypass the Toolbar.Add Method or is something going on which sets some pointer, array etc. that's needed elsewhere and going through Toolbar.Add is required -- OR would be a LOT more work than pressing buttons??
---------------------
OTHER QUESTION I HAVE ARE:
1) HCBT_CREATEWND by definition is installed before window creation.
SO, looking at the code my guess is we would have:
DO
Define a Window Class
Register the Class
--->> Hook with HCBT_CREATEWND
Create Window
--->> Hook with HCBT_ACTIVATE
ShowWindow
LOOP
2) GetWindowText returns "" when put in HCBT_CREATEWND and using the wParam for that particular control. So it appears nothing has been put in the lpszWinName (CreateWindow) when HCBT_CREATEWND is called. This seems odd as you would think the CreateWindow structure would be filled and HCBT_CREATEWND would be used to make any wanted changes before execution OTHERWISE the defaults would override what is entered in HCBT_CREATEWND?
This leads me to believe GetWindowText will only return Text AFTER window creation has executed.
3) HCBT_ACTIVATE returns just the Child (Customize) and the Parent (Form1). The question is when are the Toolbar buttons loaded (.Add Method) Before HCBT_ACTIVATE or After??
When I try to use SendMessage to the "Reset" button in HCBT_ACTIVATE, I get returned to HCBT_ACTIVATE, which generates an error, so something else is going on.