From: winapi on 27 Apr 2010 15:27 Hello, I have a toolbar which uses the TBSTYLE_DROPDOWN style. That is, when I click on the toolbar buttons, I get a popup menu, as shown in the MSDN toolbar examples. I was "wondering" if the style TBSTYLE_REGISTERDROP, is so that one can have the "popup menu display" as the mouse is (hovering) over the toolbar buttons like in the standard system menu(window menu)? If this is the case, I have tried implementing the TBN_GETOBJECT, but can't seem to get it working. Has anyone ever used this feature. If so, how would one handle the notification message. http://msdn.microsoft.com/en-us/library/bb787272(VS.85).aspx "Below" is the code from MSDN that handles the popup menu for the toolbar button click. which uses TBN_DROPDOWN. But as stated above I am "assuming" that the TBN_GETOBJECT is for menu display on mouse hover, but I might be wrong? ///////////////////////////////////////////////////////////////////// BOOL DoNotify(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { #define lpnm ((LPNMHDR)lParam) #define lpnmTB ((LPNMTOOLBAR)lParam) switch(lpnm->code) { case TBN_DROPDOWN: { // Get the coordinates of the button. RECT rc; SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc); // Convert to screen coordinates. MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2); // Get the menu. HMENU hMenuLoaded = LoadMenu(g_hinst, MAKEINTRESOURCE(IDR_POPUP)); // Get the submenu for the first menu item. HMENU hPopupMenu = GetSubMenu(hMenuLoaded, 0); // Set up the popup menu. // Set rcExclude equal to the button rectangle so that if the toolbar // is too close to the bottom of the screen, the menu will appear above // the button rather than below it. TPMPARAMS tpm; tpm.cbSize = sizeof(TPMPARAMS); tpm.rcExclude = rc; // Show the menu and wait for input. // If the user selects an item, its WM_COMMAND is sent. TrackPopupMenuEx(hPopupMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, rc.left, rc.bottom, g_hwndMain, &tpm); DestroyMenu(hMenuLoaded); return (FALSE); } } return FALSE; } Thanks.
From: Timo Kunze on 27 Apr 2010 16:12 Am 27.04.2010 21:27, schrieb winapi: > But as stated above I am "assuming" that the TBN_GETOBJECT is for menu > display > on mouse hover, but I might be wrong? You are. It's for drag'n'drop. Timo -- www.TimoSoft-Software.de - Unicode controls for VB6 "Those who sacrifice freedom for safety deserve neither." "Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf demokratischem Wege – durchsetzen."
From: winapi on 27 Apr 2010 16:31 "Timo Kunze" <TKunze71216(a)gmx.de> wrote in message news:hr7gfb$tfc$1(a)speranza.aioe.org... > Am 27.04.2010 21:27, schrieb winapi: >> But as stated above I am "assuming" that the TBN_GETOBJECT is for menu >> display >> on mouse hover, but I might be wrong? > > You are. It's for drag'n'drop. Ah, ok. Thanks.
|
Pages: 1 Prev: GetConsoleScreenBufferInfo & ReadConsoleOutputW Next: Spy++ Source Code |