1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46:
| Type tForm1 = Class (tForm) Procedure FormCreate (aSender: tObject); Private Procedure DoMessage (Var aMsg: tMsg; Var aHandled: Boolean); Procedure MenuClick; End;
Var Form1: TForm1;
Implementation
{$R *.DFM}
Const cMenuItemId = WM_USER + 1;
Procedure tForm1.DoMessage (Var aMsg: tMsg; Var aHandled: Boolean); Begin If aMsg.Message = WM_SYSCOMMAND Then If aMsg.wParam = cMenuItemId Then MenuClick; End;
Procedure TForm1.FormCreate (aSender: tObject); Begin Application.OnMessage := DoMessage;
AppendMenu (GetSystemMenu (Handle, False), MF_SEPARATOR, 0, '');
AppendMenu (GetSystemMenu (Handle, False), MF_BYPOSITION, cMenuItemId, '&Neues Menü');
AppendMenu (GetSystemMenu (Application.Handle, False), MF_SEPARATOR, 0, '');
AppendMenu (GetSystemMenu (Application.Handle, False), MF_BYPOSITION, cMenuItemId, '&Neues Menü') End;
Procedure TForm1.MenuClick; Begin MessageDlg ('Hallo', mtInformation, mbOKCancel, 0); End; |