⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mydll.pas

📁 delphi dll 热键注入代码....................
💻 PAS
字号:
unit myDLl;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;

  private
{ Private declarations }
  public
{ Public declarations }
  end;

var
  Form1: TForm1;
function HookProc(nCode: Integer; WParam: WPARAM; LParam: LPARAM): LRESULT; stdcall;
function HookOn(lpHwnd: HWND; lpType: Longint): Longint; stdcall; export;
function HookOff: Boolean; stdcall; export;

implementation

var
  hHk: HHOOK = 0;
  mhwnd: HWND = 0;
  bShow: Integer = 1;
  hThread: Cardinal;
  hmod: Pointer; //Hinstance
  //hProcessId: Cardinal;
  //mMode: Integer;

{$R *.dfm}

function HookProc(nCode: Integer; WParam: WPARAM; LParam: LPARAM): LRESULT; stdcall;
begin
 //接收按键F8开始挂钩DLL
  if (bShow = 1) and (wParam = VK_F8) then
  begin
    bShow := 5;
    Form1 := TForm1.Create(Application);
    Form1.Show;
    ShowCursor(true);
  end;
  if (bShow = 2) and (wParam = VK_F8) then
  begin
    bShow := 6;
    Form1.Hide;
  end;

  if (bShow = 3) and (wParam = VK_F8) then
  begin
    bShow := 2;
  end;
  if (bShow = 4) and (wParam = VK_F8) then
  begin
    bShow := 1;
  end;

  if (bShow = 5) then bShow := 3;
  if (bShow = 6) then bShow := 4;

  Result := CallNextHookEx(hHk, nCode, WParam, LParam);
end;

function HookOn(lpHwnd: HWND; lpType: Longint): Longint; stdcall; export;
begin
  hThread := GetWindowThreadProcessId(lpHwnd, hmod);
//注入开始
  hHk := SetWindowsHookEx(lpType, @HookProc, hInstance, hThread); // WH_KEYBOARD
  Result := hHk
end;

function HookOff: Boolean; stdcall; export;
begin
  if hHk <> 0 then
  begin
//移除挂钩
    UnHookWindowsHookEx(hHk);
    hHk := 0;
    Result := true;
  end
  else
    Result := false;
end;




end.

⌨️ 快捷键说明

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