1
2 unit Unit1;
3
4 interface
5
6 uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs,shellapi;
9
10 type
11 TForm1 = class(TForm)
12 procedure FormCreate(Sender: TObject);
13 private
14 { Private declarations }
15 public
16 procedure SysPopup (var Msg: TMsg; var Handled: Boolean);
17 {This is what handles the messages}
18 procedure GoToSite;
19
20 { Public declarations }
21 end;
22
23 var
24 Form1: TForm1;
25
26 implementation
27
28 {$R *.dfm}
29 const
30 ItemId = 99;
31
32 procedure TForm1.GoToSite;
33 begin
34 //start your browser to goto www.DevSuperPage.com
35 ShellExecute(Handle,
36 'open',
37 'http://www.DevSuperpage.com',
38 0,
39 0,
40 SW_SHOW);
41 end;
42
43 procedure TForm1.FormCreate(Sender: TObject);
44 begin
45 //sets your application event on Message to a new your new handler
46 Application.OnMessage := SysPopup;
47
48
49 //add a seperator bar on the system popup menu
50 AppendMenu (GetSystemMenu (Form1.Handle, False),MF_SEPARATOR, 0, '');
51
52 //add your personal menu option on the system popup menu
53 AppendMenu (GetSystemMenu (Form1.Handle, False), MF_BYPOSITION,
54 ItemId, '&Go to www.DevSuperPage.com');
55
56 //add a seperator bar on the system popup menu when the application is
57 // minimized
58 AppendMenu (GetSystemMenu (Application.Handle, False),MF_SEPARATOR, 0, '');
59
60 //add your menu item to the application system popup menu when minimized
61 AppendMenu (GetSystemMenu (Application.Handle, False),
62 MF_BYPOSITION, ItemId, '&Go to www.DevSuperPage.com')
63
64
65 end;
66
67 procedure TForm1.SysPopup(var Msg: TMsg; var Handled: Boolean);
68 begin
69 if Msg.message = WM_SYSCOMMAND then
70 {if the message is a system one...}
71 if Msg.WPARAM = ItemId then
72 GoToSite;
73
74 end;
75
76 end.
|