May 6, 2023

Windows Safemode 판단하기

Windows Safemode 판단하기

윈도우즈의 세이프모드 상황을 어떻게 감지합니까?

Windows API GetSystemMetrics 의 SM_CLEANBOOT 값을 사용

How to know if your application is running in SafeMode

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('안전모드에서 실행중입니다.');
Application.Terminate;
end;
2: begin
ShowMessage('네트워크 안전모드에서 실행중입니다.');
Application.Terminate;
end;
end;

Application.Run;
end.

https://support.corel.com/hc/en-us/articles/216416497-How-to-perform-an-installation-in-Safe-Mode