| unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics,
Controls, Forms, Dialogs, Menus;
type
TForm1 = class (TForm)
procedure FormCreate (Sender: TObject);
private
public
procedure WinMsg (var Msg: TMsg; var Handled: Boolean);
procedure DOWHATEVER;
end;
var
Form1 : TForm1;
implementation
const
ItemId = 99;
procedure TForm1.WinMsg (var Msg: TMsg; var Handled: Boolean);
begin
if Msg.message = WM_SYSCOMMAND then
if Msg.WPARAM = ItemId then
DOWHATEVER
end;
procedure TForm1.FormCreate (Sender: TObject);
begin
Application.OnMessage := WinMsg;
AppendMenu (GetSystemMenu (Form1.Handle, False),
MF_SEPARATOR, 0, '');
AppendMenu (GetSystemMenu (Form1.Handle, False),
MF_BYPOSITION, ItemId, '&New Item');
AppendMenu (GetSystemMenu (Application.Handle, False),
MF_SEPARATOR, 0, '');
AppendMenu (GetSystemMenu (Application.Handle, False),
MF_BYPOSITION, ItemId, '&New Item')
end;
procedure TForm2.DOWHATEVER;
begin
end;
end. | |