| |
|
|
Julian Schmidt |
CLS
Popup "&Datei"
AppendMenu 101,"Option1"
Popup "&Bearbeiten"
AppendMenu 201,"Option1"
Var Menu&=External("USER32","GetMenu",%hwnd)
ShowMenu(%hwnd, 0)
While 1
If iskey(18)
ShowMenu(%hwnd, 1)
Waitinput
Case menuitem(101) or menuitem(201) : Messagebox("Menü Angeklickt","INFO",64)
ShowMenu(%hwnd, 0)
EndIf
EndWhile
Proc ShowMenu
Parameters hdl&, modus&
If (modus&=1)
External("USER32","SetMenu",hdl&,Menu&)
ElseIf (modus&=0)
External("USER32","SetMenu",hdl&, 0)
EndIf
EndProc
|
|
|
| |
|
|
|
Nico Madysa | Der Code ist ein bisschen ungeschickt, denn solange Alt nicht gedrückt ist, rattert die Endlosschleife pausenlos Runde um Runde durch, was Systemressourcen verschwendet. Besser:
CLS
Popup "&Datei"
AppendMenu 101,"Option1"
Popup "&Bearbeiten"
AppendMenu 201,"Option1"
Var hMenu&=External("USER32","GetMenu",%hwnd)
ShowMenu(%hwnd, hMenu&, 0)
UserMessages 261'WM_SYSKEYUP
declare e%, menustatus%
clear e%, menustatus%
Whilenot e%
waitinput
if IsKey(27)
e% = 1
elseif MenuItem(101) or MenuItem(201)
Messagebox("Menü Angeklickt","INFO",64)
elseif iskey(18)
menustatus% = 1
ShowMenu(%hwnd, hMenu&, 1)
elseif menustatus%
menustatus% = 0
ShowMenu(%hWnd, hMenu&, 0)
EndIf
EndWhile
end
Proc ShowMenu
Parameters hdl&, menu&, modus%
return External("USER32","SetMenu",hdl&,if(modus%, Menu&, 0))
EndProc
|
|
|
| |
|
|