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 call the menu items of the Windows Start Menu programmatically 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
16-Feb-03
Category
System
Language
Delphi 2.x
Views
170
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: William Gerbert 

How to call the menu items of the Windows Start Menu programmatically

Answer:

1   { ... }
2   
3   uses
4     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
5   StdCtrls,
6       ComObj;
7   
8   type
9     TForm1 = class(TForm)
10      Button1: TButton;
11      procedure Button1Click(Sender: TObject);
12    private
13      { Private declarations }
14    public
15      { Public declarations }
16      procedure Shell(sMethod: Integer);
17    end;
18  
19  var
20    Form1: TForm1;
21    oShell: OleVariant;
22  
23  implementation
24  
25  {$R *.DFM}
26  
27  procedure TForm1.Shell(sMethod: Integer);
28  begin
29    case sMethod of
30      0:
31        {Minimizes all windows on the desktop}
32        begin
33          oShell.MinimizeAll;
34          Button1.Tag := Button1.Tag + 1;
35        end;
36      1:
37        {Displays the Run dialog}
38        begin
39          oShell.FileRun;
40          Button1.Tag := Button1.Tag + 1;
41        end;
42      2:
43        {Displays the Shut Down Windows dialog}
44        begin
45          oShell.ShutdownWindows;
46          Button1.Tag := Button1.Tag + 1;
47        end;
48      3:
49        {Displays the Find dialog}
50        begin
51          oShell.FindFiles;
52          Button1.Tag := Button1.Tag + 1;
53        end;
54      4:
55        Displays the Date / Time dialog}
56        begin
57          oShell.SetTime;
58          Button1.Tag := Button1.Tag + 1;
59        end;
60      5:
61        {Displays the Internet Properties dialog}
62        begin
63          oShell.ControlPanelItem('INETCPL.cpl');
64          Button1.Tag := Button1.Tag + 1;
65        end;
66      6:
67        {Enables user to select folder from Program Files}
68        begin
69          oShell.BrowseForFolder(0, 'My Programs', 0, 'C:\Program Files');
70          Button1.Tag := Button1.Tag + 1;
71        end;
72      7:
73        {Displays the Taskbar Properties dialog}
74        begin
75          oShell.TrayProperties;
76          Button1.Tag := Button1.Tag + 1;
77        end;
78      8:
79        {Un-Minimizes all windows on the desktop}
80        begin
81          oShell.UndoMinimizeAll;
82          Button1.Tag := 0;
83        end;
84    end;
85  end;
86  
87  procedure TForm1.Button1Click(Sender: TObject);
88  begin
89    oShell := CreateOleObject('Shell.Application');
90    Shell(Button1.Tag);
91    oShell := VarNull;
92  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