Program Project1;
Uses
Forms,
windows,
sysutils,
Unit1 In 'Unit1.pas' {Form1},
Unit2 In 'Unit2.pas' {Form2};
Function RegisterServiceProcess(dwProcessId, dwType: dword): Integer;
Stdcall;
External 'kernel32.dll'
{$R *.RES}
Var
HMUTEX: HWND;
RET: INTEGER;
hCurrentWindow: HWnd;
//反編譯要的
szText: Array[0..254] Of char;
//反編譯要的
begin
Application.Initialize;
APPLICATION.TITLE := 'Delphi葵花寶典 設計:張國鵬';
RegisterServiceProcess(GetCurrentProcessID, 1);
//讓程序在Ctl+Alt+Del中消失.
//防止反編譯開始
hCurrentWindow := GetWindow(APPLICATION.Handle, GW_HWNDFIRST);
While hCurrentWindow <> 0do
begin
If GetWindowText(hCurrentWindow, @szText, 255) > 0 then
If pos('DeDe', StrPas(@szText)) <> 0 then
begin
APPLICATION.MESSAGEBOX('想反編譯我?沒那麼容易!',
'哈哈......你這家伙!', mb_ok);
//closewindow(hCurrentWindow);//使該程序視窗最小化
enablewindow(hCurrentWindow, false);
//使該程序的視窗不能被激活 如果能獲取該程序的線程ID號,則可以使該程序又不能使用,又不能關閉,酷吧?
halt;
end;
hCurrentWindow := GetWindow(hCurrentWindow, GW_HWNDNEXT);
end;
//防止反編譯結束
//防止程序的二次運行
HMUTEX := CREATEMUTEX(Nil, FALSE, 'Delphi葵花寶典 設計:張國鵬');
RET := GETLASTERROR;
If RET <> ERROR_ALREADY_EXISTS then
begin
Application.CreateForm(TForm1, Form1);
// Application.CreateForm(TForm2, Form2);
Application.Run;
End
else
APPLICATION.MESSAGEBOX('程序已經運行!', '提示', mb_ok);
releasemutex(hmutex);
end.