Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
Unit1.pas
Package: Mouse Hook.zip [view]
Upload User: kukotwo
Upload Date: 2007-01-29
Package Size: 188k
Code Size: 2k
Category:
Hook api
Development Platform:
WINDOWS
- 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.