(Gast)
n/a Beiträge
|
AW: Testen ob Popupmenu gerade angezeigt wird?
15. Apr 2011, 23:56
Hmm ...
Weis nicht ob ich jetzt falsch liege.
Aber ich kann jederzeit feststellen ob mein Popupmenu geöffnet ist oder war.
Muss dazu nur ne globale Variable anlegen mit der man gegenprüfen kann.
Allerdings nonvcl.
Delphi-Quellcode:
WM_NCRBUTTONDOWN:
begin
hPopupMenu := CreatePopupMenu; // Bitmap Popupmenu
hSubSkinMenu := CreatePopupMenu; // Bitmap SkinSubmenu
if hPopupMenu <> 0 then
begin
AppendMenu(hPopupMenu, MF_OWNERDRAW, IDM_ABOUT, '');
AppendMenu(hPopupMenu, {MF_OWNERDRAW or} MF_SEPARATOR, IDM_Seperator, '');
AppendMenu(hPopupMenu, MF_OWNERDRAW or MF_POPUP, hSubSkinMenu, 'Skins');
MnuSkins := nil;
Files := nil;
FindAllFiles(ExtractFilePath(ParamStr(0)) + 'Skins', '.ske', True);
SetLength(MnuSkins, length(Files));
for IntI := 0 to length(Files) - 1 do
AppendMenu(hSubSkinMenu, MF_OWNERDRAW, IDM_SKINS + IntI, '');
AppendMenu(hPopupMenu, {MF_OWNERDRAW or} MF_SEPARATOR, IDM_Seperator, '');
AppendMenu(hPopupMenu, MF_OWNERDRAW, IDM_Close, '');
GetCursorPos(p);
MenuWahl := TrackPopupMenuEx(hPopupMenu, TPM_RETURNCMD, p.X, p.Y, WinHandle, nil);
DestroyMenu(hPopupMenu);
if MenuWahl then
SendMessage(WinHandle, WM_COMMAND, Makelong(Word(MenuWahl), 0), 0);
end;
end;
Da wo ich mein CreatePopupMenu erstelle kann ich den Status auch abfragen oder?
gruss
|
|
Zitat
|