我在WIN98下使用钩子技术,一调用函数SetWindowHookEx就蓝屏,吐血!!!但我的程序在NT、2K下都正常,WIN98是不是要打什么补钉呀,我的是WIN98第二版。
解决方案 »
- DateTimePicker 的奇怪问题???
- SendMessage发送的MSG消息都有什么??怎么查找啊
- 调用api
- Delphi7下做的form如何才能用delphi5打开(分不够再加,急,在线等)
- 各位老兄帮一把吧:在主窗体中新建一个From,如何使它在任务上显示,像主窗体一样?
- DBGridEh的DEMO1中,过滤是如何实现的
- 不能获得焦点的控件能加上OnKeyPress事件吗?
- 关于清空TDbLookupCombobox控件的问题。
- 在mis的开发中,事务和锁一般需要自己定做吗,另外,在单机上怎么验证多用户系统是否成功??//牛虻
- 是不是我太菜了,各位大虾帮帮我?一个INTERNET的“超级难题”???
- 挑战高手,寻求帮助:关于嵌入ie浏览器新建窗体问题
- OleContainer和Excel问题
可能是触及到了系统关键部分,代码有误,帖出来看看。
--------------------------------------------------------------------------
呵呵~~~~~
to 楼主
你贴出来看看阿
type
TShareData = record
g_hHookKbd: HHook;
g_Text: string;
g_hRich: THandle;
end;
PShareData = ^TShareData;function StartHook(pID: THandle): DWORD; export;
function StopHook: DWORD; export;
function KeyBoardCallBack(Code: integer; wParam: word; lParam: Longint): LongInt;
implementationimplementationvar
ShareData: PShareData;function StartHook(pID: THandle): DWORD;
function GetModuleHandleFromInstance: THandle;
var
s: array[0..512] of char;
begin
GetModuleFileName(HInstance, s, SizeOf(s) - 1);
Result := GetModuleHandle(s);
end;
begin
Result := 1; ShareData^.g_hHookKbd := SetWindowsHookEx(WH_KEYBOARD, @KeyBoardCallBack, GetModuleHandleFromInstance, pID);
if (ShareData^.g_hHookKbd = 0) then Result := 0;
end;function StopHook: DWORD;
begin
UnhookWindowsHookEx(ShareData^.g_hHookKbd); Result := 1;
end;function KeyBoardCallBack(Code: integer; wParam: word; lParam: Longint): LongInt;
begin
Result := CallNextHookEx(ShareData^.g_hHookKbd, Code, wParam, lParam);
end;
The SetWindowsHook function is obsolete. This function is provided only for compatibility with 16-bit versions of Windows. Win32-based applications should use the SetWindowsHookEx function.SetWindowsHookEx
The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the system. // 应该是98系统的问题