Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to add menu items to the system menu of a form. Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
add menu items to the system menu of a form. 08-Aug-04
Category
System
Language
Delphi All Versions
Views
319
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
Darley, F. Joe
Reference URL:
			

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.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC