打印本文 打印本文 关闭窗口 关闭窗口
怎样知道你的程序是运行在安全模式呢?
作者:武汉SEO闵涛  文章来源:敏韬网  点击数852  更新时间:2009/4/23 18:42:46  文章录入:mintao  责任编辑:mintao
Use Windows API GetSystemMetrics with SM_CLEANBOOT parameter, this specifies how the system was started, in your project´s code use:

program Project1;

uses
  Forms,
  Windows,
  Dialogs,
  Unit1 in ''''Unit1.pas'''' {Form1};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);


  case GetSystemMetrics(SM_CLEANBOOT) of
    1: begin
         ShowMessage(''''Running in Safe Mode: Fail-Safe Boot'''');
         Application.Terminate;
       end;
    2: begin
         ShowMessage(''''Running in Safe Mode: Fail-safe with network boot'''');
         Application.Terminate;
       end;
  end;

   Application.Run;
end.

打印本文 打印本文 关闭窗口 关闭窗口