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.