Toolbar issue on double-click

Well, this is not a problem but it bothers me to see a window that quickly appears and disappears when I double click on the toolbar that I have created with CreateWindowEx. How could I deactivate it. It looks like a ToolWindow in which you can reorder your toolbar menu, a predefined window created by Windows. There must be a way of deactivating it. Thanks!

After researching a bit more I found out that what I want is to do is disable TB_CUSTOMIZE. When he user clicks on the toolbar no customize toolbar window must appear.
Quickly reading http://msdn.microsoft.com/en-us/library/windows/desktop/bb787307(v=vs.85).aspx , I suppose that you can subclass the toolbar and simply discard TB_CUSTOMIZE.
I subclassed the toolbar but I don't know how to discard TB_CUSTOMIZE. I get the TB_CUSTOMIZE message and I do what?
You do nothing. Simply return. Don't pass the message to the original window procedure, effectively doing nothing with it and therefore discarding it.
Thanks
If I do this
1
2
3
LRESULT CALLBACK tlb_proc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam){
    return 0;
}

The toolbar doesn't show the Customize Toolbar but neither shows the buttons. I suppose I must return some messages.

Now, If I do this
1
2
3
LRESULT CALLBACK tlb_proc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam){
    return CallWindowProc(orig_tlb_proc, hWnd, Message, wParam, lParam);
}

I send all the messages, including the TB_CUSTOMIZE, WM_MBUTTONDBLCLK, so, this doesn't solve anything.
Last edited on
You have the message right there. Can't you throw in a switch() or if statement?

http://www.cplusplus.com/doc/tutorial/control/

It is almost the exact same as programming a window procedure for a window of your own making.
1
2
3
4
5
6
7
LRESULT CALLBACK tlb_proc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam){
    if (Message == TB_CUSTOMIZE) {
        return 0;
    } else {
        return CallWindowProc(orig_tlb_proc, hWnd, Message, wParam, lParam);
    }
}


The integer value of the TB_CUSTOMIZE is 1051. After saving as a text file all the integer values of all the messages sent to tlb_proc() I didn't found this one.
Last edited on
This one works. Just tell me if it is right to do it this way. I don't want the toolbar to do anything when double clicked.

1
2
3
4
5
6
7
LRESULT CALLBACK tlb_proc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam){
    if (Message == WM_LBUTTONDBLCLK) {
        return 0;
    } else {
        return CallWindowProc(orig_tlb_proc, hWnd, Message, wParam, lParam);
    }
}


Thanks
Well, I don't know if discarding WM_LBUTTONDBLCLK has any other side effects in the toolbar as I am not a GUI-in-C++ guy. I just happen to know a thing here and there. Test it out to see if it works properly.
Topic archived. No new replies allowed.