72 lines
1.6 KiB
Plaintext
72 lines
1.6 KiB
Plaintext
unit DScrLckMain;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, KeyMonDLL;
|
|
|
|
type
|
|
TDlgScrLckMain = class(TForm)
|
|
btnLockScreen: TButton;
|
|
Label1: TLabel;
|
|
edPass: TEdit;
|
|
procedure btnLockScreenClick(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
KeyMonDll_: TKeyMonDLL;
|
|
public
|
|
{ Public declarations }
|
|
Constructor Create(aOwner: TComponent); override;
|
|
Destructor Destroy; override;
|
|
|
|
property KeyMon: TKeyMonDLL read KeyMonDll_;
|
|
end;
|
|
|
|
var
|
|
gMain: TDlgScrLckMain = nil;
|
|
DlgScrLckMain: TDlgScrLckMain;
|
|
|
|
implementation
|
|
|
|
uses
|
|
DLockScreen, Tocsg.Path, Define;
|
|
|
|
{$R *.dfm}
|
|
|
|
Constructor TDlgScrLckMain.Create(aOwner: TComponent);
|
|
begin
|
|
Inherited Create(aOwner);
|
|
ASSERT(gMain = nil);
|
|
gMain := Self;
|
|
Caption := APP_NAME;
|
|
KeyMonDll_ := TKeyMonDLL.Create(Handle, MAP_FILENAME, GetRunExePathDir + DLL_KEYMON);
|
|
if KeyMonDll_.LastError <> ERROR_SUCCESS then
|
|
begin
|
|
MessageBox(Handle, PChar(Format('DLL 로드 실패. Error = %d',
|
|
[KeyMonDll_.LastError])), APP_NAME, MB_ICONSTOP or MB_OK);
|
|
Close;
|
|
end;
|
|
end;
|
|
|
|
Destructor TDlgScrLckMain.Destroy;
|
|
begin
|
|
FreeAndNil(KeyMonDll_);
|
|
gMain := nil;
|
|
Inherited;
|
|
end;
|
|
|
|
procedure TDlgScrLckMain.btnLockScreenClick(Sender: TObject);
|
|
begin
|
|
edPass.Text := Trim(edPass.Text);
|
|
if edPass.Text = '' then
|
|
begin
|
|
MessageBox(Handle, PChar('비밀번호를 입력해주십시오.'), APP_NAME, MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
TDlgLockScreen.Create(Self, edPass.Text).DoLockScreen;
|
|
end;
|
|
|
|
end.
|