unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,shellapi;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure SysPopup (var Msg: TMsg; var Handled: Boolean);
{This is what handles the messages}
procedure GoToSite;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
ItemId = 99;
procedure TForm1.GoToSite;
begin
//start your browser to goto www.DevSuperPage.com
ShellExecute(Handle,
'open',
'http://www.DevSuperpage.com',
0,
0,
SW_SHOW);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//sets your application event on Message to a new your new handler
Application.OnMessage := SysPopup;
//add a seperator bar on the system popup menu
AppendMenu (GetSystemMenu (Form1.Handle, False),MF_SEPARATOR, 0, '');
//add your personal menu option on the system popup menu
AppendMenu (GetSystemMenu (Form1.Handle, False), MF_BYPOSITION,
ItemId, '&Go to www.DevSuperPage.com');
//add a seperator bar on the system popup menu when the application is
// minimized
AppendMenu (GetSystemMenu (Application.Handle, False),MF_SEPARATOR, 0, '');
//add your menu item to the application system popup menu when minimized
AppendMenu (GetSystemMenu (Application.Handle, False),
MF_BYPOSITION, ItemId, '&Go to www.DevSuperPage.com')
end;
procedure TForm1.SysPopup(var Msg: TMsg; var Handled: Boolean);
begin
if Msg.message = WM_SYSCOMMAND then
{if the message is a system one...}
if Msg.WPARAM = ItemId then
GoToSite;
end;
end.