Page 1 of 2 12 LastLast
Results 1 to 40 of 41

Thread: LB_GETCOUNT (Megatron, RobDog, MartinLiss)

  1. #1
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814

    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
    Attached Files Attached Files
    Last edited by dw85745; Nov 19th, 2004 at 01:25 PM.

  2. #2
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 01
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    59,467
    I wasn't able to run the project because it couldn't load the
    imagelist and toolbar, but it looks like in the dblclick procedure
    your doing a lockwindowupdate and then you are doing the
    sendmessage to get the lb_count. I think it may fail because the
    lb is locked? Try sendmessaging before the lockwindowupdate.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (VBA, VB 6, VB.NET, C#)
    Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007

  3. #3
    Super Moderator manavo11's Avatar
    Join Date
    Nov 02
    Location
    Other side of town from si_the_geek
    Posts
    7,171
    I deleted the other thread.


    Has someone helped you? Then you can Rate their helpful post.

  4. #4
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Thanks for responding RobDog.

    Have tried both with and without lockwindowupdate.

    "With" was latest attempt.

    Is it your system with Toolbar and Imagelist?

  5. #5
    Super Moderator manavo11's Avatar
    Join Date
    Nov 02
    Location
    Other side of town from si_the_geek
    Posts
    7,171
    The handle must be wrong... Try this :

    Replace

    VB Code:
    1. hWnd = FindWindow("ListBox", vbNullString)

    with

    VB Code:
    1. Dim listbox As Long
    2.          listbox = FindWindowEx(hWnd, 0&, "ListBox", vbNullString)

    and change hwnd to listbox accordingly farther down.

    For the right listbox, use :

    VB Code:
    1. listbox2 = FindWindowEx(hWnd, listbox, "ListBox", vbNullString)

    and then use listbox2 to lock, get count or whatever you need


    Has someone helped you? Then you can Rate their helpful post.

  6. #6
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    manavo11:

    1. Thanks for deleting thread.
    2. Thanks for idea re FindWindowEx.

    ----------------------------

    Using Spy++ your way returns the left listbox handle not right BUT also returns a count of "4" which is the original count of tool buttons in the right -- (????) -- but since count taken after "Reset" count should be "7" NOT 4.

    Also interesting is that toolbar buttons belong (parent is) the Form NOT the listbox.

    Have redone code incorporating you idea along with some debug routines.

    Any interest in helping me solve this? If so, post response and will post updated code.

    Thanks
    David

  7. #7
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    My first guess, like manavo11 said, is that you're using an incorrect handle.

    Which ListBox are you trying to get the handle of?

    Or better yet, see if you can upload the project again, as I couldn't get it to work.

  8. #8
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Thanks for responding Megatron.

    As coded the first button is automatically transferred from the right to the left.

    The objective is at startup to:

    1. Add all needed buttons to the toolbar
    2. Transfer at startup selected buttons so they do not show to left listbox, which leaves them available to end user when involking toolbar and segregates those currently showing from those not. IHMO this is how MS meant to use the Customize method.

    3. Setting toolbars to (Visible = False) does not allow user to select and using "<--Remove" causes them to be deleted NOT transferred.

    David
    Attached Files Attached Files

  9. #9
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    I ran your code, and LB_GETCOUNT seems to be returing the correct results.

    Where's the problem? Is it the fact that "Copy" is still in the left list box?

  10. #10
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Thanks for looking at code Megatron:


    Remember the objective during App startup is:


    1. AT StartUp, Add all needed buttons to the toolbar (these will initially appear in the right listbox because of the Toolbar Add Method).

    2. AT Starup, using the API, transfer buttons, you do NOT want to be visible in the toolbar from the right to the left listbox.

    ---------------------

    AFTER startup, when the end user involkes the Customize method he should see buttons currently showing on the toolbar in the right listbox and those NOT showing but available in left listbox.

    IHMO this is how MS meant to use the Customize method.

    Currently the API code JUST finds the first button "Copy" and transfers it from right to left. This is because the Reset button was pressed using SendKey which by default selected the first button.

    I WANT TO BE ABLE TO SELECT ANY BUTTON using the API (by name, key or index) and transfer it from right to left.

    NO code is included to do this (e.g "Print" button) as I could not get Spy++ to even find any button in either listbox.

    ALSO, the button count should be 7 not 4 as 7 buttons are in the right listbox when LB_GETCOUNT is executed.
    Last edited by dw85745; Nov 22nd, 2004 at 07:46 AM.

  11. #11
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    Hm, I'm starting to understand it now.

    Essentially, you require a method to transfer a ListItem of your choice (Copy, Print, etc.) to the listbox of your choice? (Either right or left)

    This might get a little tricky for 2 reasons

    1) They use graphics
    2) We might have to write code to synchronize the modified listboxes with the toolbar display.

    It will be easier to instead "guide" VB into performing the operations for you. By "guide" I mean, selecting the appropiate item in the listbox, and invoking the code from the Add/Remove buttons via SendKeys or SendMessage.

    This "guide" approach simplifies the process by allowing VB to manage the underlying coding. All you have to do is select your desired ListItem in the ListBox, then use SendMessage or SendKeys to execute the Add/Remove buttons.

  12. #12
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814

    It will be easier to instead "guide" VB into performing the operations for you. By "guide" I mean, selecting the appropiate item in the listbox, and invoking the code from the Add/Remove buttons via SendKeys or SendMessage
    This is the approach I'm trying. My first attempt (see first post with attached zip) was API, but decided "SendKeys" as easier.


    HOWEVER to use SendKeys-- you still need to ID the listbox button which is where the PROBLEM IS?

    Any ideas why:

    1. LB_GETCOUNT returns 4 rather than 7 ?
    (SendKeys "Reset" occurs AFTER the Add Method to add the 3 additional buttons and BEFORE the count is taken

    2. Why Spy++ can't find the listbox "TEXT" associated with the image?

  13. #13
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    1. I'll have to check this again

    2. Remember this is still a generic ListBox class (just a little more fancy). They do not have separate windows for the individual list items.

    Let me how another look at his

  14. #14
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    I see what you mean now. LB_GETCOUNT doesn't seem to update until after you dismiss the "Customize" dialog, and bring it up again.

    I'll work at this a little while longer

  15. #15
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    Here's what I have so far.

    • LB_SETCURSEL is used to set the current selection in the listbox.
    • BM_CLICK is used to click the "remove" button, which invokes the necessary code to transfer the selected item from the right listbox, to the left.
    • The whole SaveToolBar, RestoreToolBar bit at initialization seemed rather unnecessary, so I removed them from the project (you can always uncommet them)


    You might even want to rewrite some of the SendMessage lines into procedures.

    Let me know if you have any problems with it.

    (P.S: My code is a mess)
    Attached Files Attached Files

  16. #16
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Thanks Megatron.

    Will take a look hopefully tomorrow (our Thanksgiving so don't know if I get any time).

    Can't recall if Canada's Thanksgiving is tomorrow or +/- week.
    Either way, have a happy Holiday.

    David

  17. #17
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    Thanks, and same to you

    (About 5-6 weeks ago for me, though)

  18. #18
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Hi Megatron:

    Played with your example and looks *** GOOD ***.

    Only thing left is to trap the WM_ACTIVATE message so
    that at startup the Customize form can be invoked using
    the .Customize method and then a message to Close the Customized form.

    This way ALL buttons will be available to user after StartUp, with
    those showing in the toolbar on the right and those available to
    the user to change the toolbar on the left.

    As I recall, WM_ACTIVATE, in this instance will require a SystemWide hook.

    ----------------------

    I found it interesting that the key to the listbox was:

    VB Code:
    1. SendMessage hListBox2, LB_SETCURSEL, -1, 0
    2.  
    3.  
    4. FYI a call to "GetListBoxItems" after executing above line will now return
    5. the correct string which provides a text listing of all items (buttons).
    ----------------------------------------

    David

  19. #19
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    Yes, a hook is the way to go, but I don't think it has to be system wide (will get back to you on it).

    Here's something else I was thinking of. What if you were to write your code into a function, and just execute this function everytime you invoke the "Customize" method of the toolbar. To simplify further, write a wrapper function that does both.

    I.e.
    VB Code:
    1. Sub CustomizeEx( tbr As ToolBar )
    2.     tbr.Customize
    3.     Call MyCustomFunction()
    4. End Sub
    Give that a shot, and if it fails, use hooks.

  20. #20
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Hi Megatron:



    One big problem is when you trigger Customize like tbr.Customize all code stops on this line as the Customize form now has the focus.

    A double click allows you to trap the Customize handle so processing can continue.

    --------------------------------------

    I was thinking of something similiar but still working on the details. Something like:

    1. Rather than calling the function at startup, call the function the first time the customize method is triggered. Use a static variable (probably global) and at first call add and transfer (Right to Left LB) the available buttons. Prior to closing the Customize form save the button names (or keys).

    2. While the App is active, any time Customized is triggered, all buttons should show properly, both those on the toolbar (right listbox) and available (left LB) -- will double check this tomorrow.

    3. Still working on how to load the Customized form after the first time the App is run

    David

  21. #21
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Attached is a revised sample.

    1. Checked on the form and once toolbar buttons manipulated, the Customize form keeps them as set during execution even if the Customize form loses focus.

    2. Doesn't appear system wide hook is needed. Using a module variable (see example) appears to solve problem.

    3. All that is still needed in Sample is way to save and reload toolbar as designed by user.

    David.
    Attached Files Attached Files

  22. #22
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Attached is sample that includes Save and Load Toolbar Buttons.

    Only other thing I found is that a direct call to tbrActions_Click
    for whatever reason causes FindWindow NOT to return a handle to the Customize form.

    Have to quit for now, but plan to try WM_NC Double Click (need to look up) to see what happens rather than using the direct call.

    Any other feedback, corrections, improvements appreciated.

    David
    Attached Files Attached Files

  23. #23
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Hi Megatron:

    Got It --- See Attached.

    Will post clean code day or two to CodeBank with 1/2 credit to you unless I see post this thread with a better solution.

    If you prefer to post to codebank, OK with me as I just want solution, could care less about credit.

    Thanks
    David
    Attached Files Attached Files

  24. #24
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    Looks good. Glad everything worked out.

    And I don't even know how to use the code bank, so it's probably better if you submit it.

  25. #25
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Here's cleaned up version. Looks good.

    ------------------------

    Spoke a little too soon. Ran into problems saving toolbar configuration on QueryUnload. Replicating of Doubleclick on toolbar works to trigger call to "Save" routine, but "Customize" form doesn't load from DBLClick so so handle returns "0".

    Any ideas?
    Attached Files Attached Files

  26. #26
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    Just some initial reactions:

    When I double-click the toolbar, the customize dialog closes, but if I do it a second time, it re-opens and stays.

    If I press the commandbutton first, the customize dialog will always open then close right after. I suspsect it has to do with an ignored error, but I'll investigate this further later today

  27. #27
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Megatron:

    The way I have it designed is:

    1. First double click on toolbar adds the extra buttons and transfers them to the listbox. This way the extra buttons stay in the imagelist control unless needed -- better use memory.

    Per your post noticed that the Customize should stay up after
    extra buttons loaded. Will check on this.

    2. Any subsequent double click just brings up the customized form to allow user to make adjustment.

    3. Command1 is being used to test the TBSaveConfig which will be invoked at QueryUnload. This way the user can adjust tools anyway he wants while App is running (Customized save the setup while App running).

    4. Save is only needed for the next time the App is run.

    4. Thinking may need a WH to trap Customize activating
    Last edited by dw85745; Nov 28th, 2004 at 03:32 PM.

  28. #28
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    Okay, so double clicking allows you to trap the creating the Customize dialog, whereas invoking the Customize method directly doesn't, correct?

    If so, then yes you're right: one method would be to install a WH_GETMESSAGE hook, and trap the WM_CREATE message.

  29. #29
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814

    Okay, so double clicking allows you to trap the creating the Customize dialog, whereas invoking the Customize method directly doesn't, correct?
    Yes. Had plan to try a hook later to get above working.

    Right now, just wanted to save configuration during QueryUnload. This would get App working.

    Thought I had was to try a delay between CLICKs to see if a timing difference has an effect.

    Thanks
    David

  30. #30
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814
    Megatron:

    GOT ME STUMPED.

    What's going on that when you doubleclick the toolbar with the mouse that the "Customize Form" comes up ----

    YET, when you simulate the doubleclick in code you're taken to the tbrActions_DblClick INSTEAD of loading the "Customize Form"??

    --------------------------------

    Still working on the WH to intercept tbrActions.Customize.

    THanks

    David

  31. #31
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    I'm leaning towards a custom message being sent, though theoretically, dispatching the appropiate messages should trigger it (if it exists) indirectly.

    Let me chew on this for a bit.

  32. #32
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    Just as I suspected, there is a customized message being sent indirectly, when the "Customize" method is invoked.

    Sending this message, alone, has no effect. Interestingly, not even WM_LBUTTONDOWN/UP or the double-click messages are being processed by the toolbar. This lead me to discover that the toolbar is actually a container for another window. I'll experiment some more with this.

  33. #33
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287
    Okay, got it.

    This is the handle of the window you want to send it to
    Code:
    hwin = FindWindowEx(tbrActions.hwnd, 0, "msvb_lib_toolbar", vbNullString)

  34. #34
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814

    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.

    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

  35. #35
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814

    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]

  36. #36
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287

    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.

  37. #37
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814

    Re: LB_GETCOUNT (Megatron, RobDog, MartinLiss)

    Have tried all three differerent classes that have shown up below:


    VB Code:
    1. Private Sub DBLClickToolbar()
    2.  
    3.    'Get the Form Handle
    4.    hForm = FindWindow(vbNullString, "howto_hidden_toolbar_buttons")
    5.    If hForm Then
    6.    
    7.       'Get the Toolbar Handle
    8.       hToolbar = FindWindowEx(tbrActions.hwnd, 0, "msvb_lib_toolbar", vbNullString)
    9. '      hToolbar = FindWindowEx(hForm, 0, "Toolbar20WndClass", vbNullString)
    10. '      hToolbar = FindWindowEx(hForm, 0, "ToolbarWindow32", vbNullString)
    11.       If hToolbar Then
    12.  
    13.          Whatever ..............
    14.  
    15. End Sub

  38. #38
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287

    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.

  39. #39
    Frenzied Member
    Join Date
    Jul 01
    Location
    Tucson, AZ
    Posts
    1,814

    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

    ******************************
    Last edited by dw85745; Dec 11th, 2004 at 11:04 AM.

  40. #40
    Software Eng. Megatron's Avatar
    Join Date
    Mar 99
    Location
    Canada
    Posts
    11,287

    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?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •