Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 May : Problem with Form's System Menu
| Subject: | Problem with Form's System Menu |
| Posted by: | "Pete" (spam@nowhere.com) |
| Date: | Fri, 11 May 2007 12:00:55 |
I'm adding a menu item to a main form's system menu using this code:
var
hMenu : THandle;
begin
hMenu:= GetSystemMenu(Form1.Handle, false);
AppendMenu(hMenu, mf_Separator, 0, '');
AppendMenu(hMenu, mf_Enabled, $E010, 'MyCaption');
end;
then showing a pop-up menu when the item is clicked:
procedure TForm1.AppMsg (var Msg : TMsg; var Handled : boolean);
begin
if Msg.WParam = $E010 then begin
>> Handled:= true;
PopUpMenu1.PopUp(Left + 50, Top + 70);
end;
end;
This works immediately after running the app, but after using other app
features, clicking the menu item does nothing. A breakpoint on the line
marked >> is never reached.
Any ideas what is causing this?
Cheers...
Pete (D3)