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 know if your application is running in SafeMode 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
19-Aug-03
Category
Others
Language
Delphi 2.x
Views
112
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jorge Abel Ayala Marentes 

Sometimes an application uses resources that doesn´t exist when windows is running 
in SafeMode, so how do you detect this situation?

Answer:

Use Windows API GetSystemMetrics with SM_CLEANBOOT parameter, this specifies how 
the system was started, in your project´s code use: 

1   program Project1;
2   
3   uses
4     Forms,
5     Windows,
6     Dialogs,
7     Unit1 in 'Unit1.pas' {Form1};
8   
9   {$R *.RES}
10  
11  begin
12    Application.Initialize;
13    Application.CreateForm(TForm1, Form1);
14  
15    case GetSystemMetrics(SM_CLEANBOOT) of
16      1:
17        begin
18          ShowMessage('Running in Safe Mode: Fail-Safe Boot');
19          Application.Terminate;
20        end;
21      2:
22        begin
23          ShowMessage('Running in Safe Mode: Fail-safe with network boot');
24          Application.Terminate;
25        end;
26    end;
27  
28    Application.Run;
29  end.


This way you can prevent the user to use your application and avoid havoc!

			
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