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
CBuilder All Versions
Views
489
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
Darley, F. Joe
Reference URL:
			
1   
2   //------------------------UNIT.H-----------------------------
3   //---------------------------------------------------------------------------
4   
5   #ifndef Unit1H
6   #define Unit1H
7   //---------------------------------------------------------------------------
8   #include <Classes.hpp>
9   #include <Controls.hpp>
10  #include <StdCtrls.hpp>
11  #include <Forms.hpp>
12  //---------------------------------------------------------------------------
13  class TForm1 : public TForm
14  {
15  __published:	// IDE-managed Components
16          TApplicationEvents *ApplicationEvents1;
17          void __fastcall FormCreate(TObject *Sender);
18          void __fastcall SysPopup(tagMSG &Msg,  bool &Handled);
19  private:	// User declarations
20        void GoToSite(void);
21  public:		// User declarations
22  
23          __fastcall TForm1(TComponent* Owner);
24  };
25  //---------------------------------------------------------------------------
26  extern PACKAGE TForm1 *Form1;
27  //---------------------------------------------------------------------------
28  #endif
29  
30  //------------------------UNTI.CPP-----------------------------------
31  //---------------------------------------------------------------------------
32  
33  #include <vcl.h>
34  #pragma hdrstop
35  
36  #include "Unit1.h"
37  //---------------------------------------------------------------------------
38  #pragma package(smart_init)
39  #pragma resource "*.dfm"
40  TForm1 *Form1;
41  const
42   ItemId=99;
43  //---------------------------------------------------------------------------
44  __fastcall TForm1::TForm1(TComponent* Owner)
45          : TForm(Owner)
46  {
47  }
48  
49  void TForm1::GoToSite(void)
50  {
51  //start your browser to goto www.DevSuperPage.com
52  ShellExecute(Handle,
53                 "open",
54                 "http://www.DevSuperpage.com",
55                 0,
56                 0,
57                 SW_SHOW);
58  
59  }
60  //---------------------------------------------------------------------------
61  void __fastcall TForm1::SysPopup(tagMSG &Msg,  bool &Handled)
62  {
63   if(Msg.message == WM_SYSCOMMAND){
64    if (Msg.wParam == ItemId){
65      GoToSite();
66    }
67   }
68  }
69  
70  void __fastcall TForm1::FormCreate(TObject *Sender)
71  {
72   //sets your application event on Message to a new your new handler
73    Application->OnMessage = SysPopup;
74  
75    //add a seperator bar on the system popup menu
76    AppendMenu (GetSystemMenu (Form1->Handle, false),MF_SEPARATOR, 0, NULL);
77  
78    //add your personal menu option on the system popup menu
79    AppendMenu (GetSystemMenu (Form1->Handle, false), MF_BYPOSITION,
80    ItemId, "&Go to www.DevSuperPage.com");
81  
82    //add a seperator bar on the system popup menu when the application is
83    // minimized
84   AppendMenu (GetSystemMenu (Application->Handle, false),MF_SEPARATOR, 0, NULL);
85  
86   //add your menu item to the application system popup menu when minimized
87     AppendMenu (GetSystemMenu (Application->Handle, false),
88      MF_BYPOSITION, ItemId, "&Go to www.DevSuperPage.com");
89  }
90  //---------------------------------------------------------------------------
91  
92  


			
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