📄 unit1.~pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
WM_TestMessage = WM_USER + 2000;
var
Form2: TForm2;
myhwnd:hwnd;
function HookOn(lpHwnd:HWND):bool;stdcall;external 'OLHookdll.dll' name 'sethook';
function hookoff(lpHwnd:HWND):Bool;stdcall;external 'OLHookdll.dll' name 'endhook';
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
myhwnd:=findwindow(nil,'浪漫庄园');
if myhwnd<>0 then
begin
if HookOn(myhwnd) then
EDIT1.Text:='$'+inttohex(myhwnd,8);
end;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if myhwnd<>0 then
hookoff(myhwnd);
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
if myhwnd<>0 then
begin
sendmessage(myhwnd,WM_TestMessage,0,0);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -