syswindow.dpr

来自「一个简单的开机保护程序 无任何控件 全api编写 关键字 :键盘钩子」· DPR 代码 · 共 36 行

DPR
36
字号
program SysWindow;

{$R 'ico.res' 'ico.rc'}
uses
  Windows,
  MainFrame in 'MainFrame.pas',
  Public_Unit in 'Public_Unit.pas',
  uConst in 'uConst.pas';

begin
  SetLastError(0);
  hMutexRun := CreateMutex(nil, True, MutexName);
  if (hMutexRun = 0) or (GetLastError() = ERROR_ALREADY_EXISTS) then
    MessageBox(0, ERR_ALREADYRUN, SYS_INFO, MB_OK)
  else begin
    DllFilePath := Pchar(ExtractFilePath(ParamStr(0)) + HookDll);
    ExtracDllFile(MYDLL, RT_RCDATA);   {分离出Dll}
    LoadDll(DllFilePath);              {获取Dll中的函数}
    MainHandle := CreateWindow;        {构建主窗体}
    if MainHandle = 0 then Halt;
    SetAlpaBlend(150, MainHandle);     {设置透明度}
    SetMainTop(True, MainHandle);      {窗口置顶}
    ShowWindow(MainHandle,SW_MAXIMIZE);{全屏显示}

    while GetMessage(Msg, 0, 0, 0) do  {消息循环}
    begin
      TranslateMessage(Msg);
      DispatchMessage(Msg);
    end;

    DeleteFile(DllFilePath);           {删除Dll}
    DestroyWindow(MainHandle);
    ReleaseMutex(hMutexRun);
  end;
end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?