![]() |
nonVCL - PopUp Menue erstellen
Hi,
ich habe ein kleines Problem beim mit einem PopUp-Menue was nicht angezeigt wird.
Delphi-Quellcode:
Was ist daran falsch ?
function DlgFunc(hw: hWnd; uMsg: DWORD; wParam: wParam; lParam: lParam): bool; stdcall;
var hMenue: HMENU; p: TPoint; begin Result := True; case uMsg of WM_INITDIALOG: begin hMenue := CreatePopUpMenu; // Menüs mit Einträgen füllen AppendMenu(hMenue, MF_STRING, IDM_ITEM1, '1'); AppendMenu(hMenue, MF_STRING, IDM_ITEM2, '2'); // SetMenu(hW, hMenue); end; WM_CONTEXTMENU: begin GetCursorPos(p); TrackPopupMenu(hMenue, TPM_RIGHTALIGN or TPM_RIGHTBUTTON, p.x, p.y, 0, hW, nil); {$IFDEF DEBUG} showmessage(format('%d, %d ', [p.x,p.y])); {$ENDIF} end; //... WM_DESTROY: begin DestroyMenu(hMenue); PostQuitMessage(0); end; else result := false; end; end; BEGIN InitCommonControls; hdlg := DialogBoxParam(HInstance, MAKEINTRESOURCE(100), 0, @DlgFunc, 0); END. |
Re: nonVCL - PopUp Menue erstellen
Delphi-Quellcode:
Ok. Sollte man doch als globale Variable setzen. :wall:
var
hMenue: HMENU; // <---<< function DlgFunc(hw: hWnd; uMsg: DWORD; wParam: wParam; lParam: lParam): bool; stdcall; p: TPoint; begin //... |
Re: nonVCL - PopUp Menue erstellen
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:58 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz