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 Windows system dialogs from code 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
10-Oct-02
Category
Dialogs
Language
Delphi 2.x
Views
67
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

How to call Windows system dialogs from code

Answer:

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