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
|