📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
MapFileUnit;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
procedure WndProc(var Mess: TMessage); override;
end;
var
Form1: TForm1;
ZW_MSG : UINT;
HMapFile:THandle;
CommonData:pCommonData;
implementation
{$R *.DFM}
function EnableMouseHook(hld:hwnd): boolean; stdcall; external 'MHK.dll';
function DisableMouseHook: boolean; stdcall; external 'MHK.dll';
procedure TForm1.WndProc(var Mess: TMessage);
begin
if (mess.msg = ZW_MSG) then
begin
caption := 's';
if CommonData<>nil then with CommonData^ do
Caption := Format('Mouse Pos: %d, Y : %d',
[MousePos.X,
MousePos.Y]);
end;
inherited;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ZW_MSG := RegisterWindowMessage('WM_ZWNOTIFY');
//CommonData := nil;
MapCommonData(CommonData,HMapFile);
if not(EnableMouseHook(handle)) then ShowMessage('Enable Mouse Hook failed.');
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if not(DisableMouseHook) then ShowMessage('Disable Mouse Hook failed.');
if CommonData<>nil then UnMapCommonData(CommonData,HMapFile);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -