MirceaVleju
Programmer
How can i edit the application menu! (The one with restore,size,menu,etc)
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
AppEvnts, ExtCtrls, Menus;
type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
Item1: TMenuItem;
Item2: TMenuItem;
Item3: TMenuItem;
Item4: TMenuItem;
procedure FormCreate(Sender: TObject);
private
procedure OnMessage(var Msg: tagMSG;
var Handled: Boolean);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
const
mnuBreak = 149; //any numbers
mnuMyItem = 150;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
//catch menu click for my item
//Note: Delphi 5 users can use the new TApplicaton component, use the OnMessage event
Application.OnMessage:= OnMessage;
//add seperator at end
AppendMenu(GetSystemMenu(Form1.Handle, False),
MF_SEPARATOR,
mnuBreak,
'');
//now add my item at end
AppendMenu(GetSystemMenu(Form1.Handle, False),
MF_STRING,
mnuMyItem,
'&My Item');
//last add submenu item and assign popupmenu handle
AppendMenu(GetSystemMenu(Form1.Handle, False),
MF_POPUP,
PopupMenu1.Handle,
'&Sub Menu');
end;
procedure TForm1.OnMessage(var Msg: tagMSG;
var Handled: Boolean);
begin
//look in win32.hlp for more information; WM_SYSCOMMAND
if Msg.Message = WM_SYSCOMMAND then
begin
if Msg.WParam = mnuMyItem then //i guess the handle we assigned
ShowMessage('Your handler here');
end;
end;