...im Systemmenü eines Fensters neue Menüeinträge hinzufügen?
|
Autor:
Thomas Stutz |
[ Tip ausdrucken ] | | |
private
procedure WMSysCommand(var Msg: TMessage); message WM_SYSCOMMAND;
{...}
const
ID_ABOUT = WM_USER + 1;
ID_HELP = WM_USER + 2;
ID_NEWLINE = WM_USER + 4;
{...}
implementation
{...}
procedure TForm1.FormCreate(Sender: TObject);
var
SysMenu: THandle;
begin
SysMenu := GetSystemMenu(Handle, False);
InsertMenu(SysMenu, Word(-1), MF_SEPARATOR, ID_NEWLINE, '');
InsertMenu(SysMenu, Word(-1), MF_BYPOSITION, ID_HELP, 'Help');
InsertMenu(SysMenu, Word(-1), MF_BYPOSITION, ID_ABOUT, 'About');
end;
procedure TForm1.WMSysCommand;
begin
case Msg.wParam of
ID_ABOUT : ShowMessage('About-Menu Item Pressed!');
ID_HELP : ShowMessage('Help-Menu Item Pressed!');
end;
inherited;
end;
Bewerten Sie diesen Tipp:
|
|
|