我在WIN98下使用钩子技术,一调用函数SetWindowHookEx就蓝屏,吐血!!!但我的程序在NT、2K下都正常,WIN98是不是要打什么补钉呀,我的是WIN98第二版。
解决方案 »
- 用DBGridEh1连接ADODataSet1,如何知道更新的是哪行数据?
- 关于vox文件播放的问题??????????????????????????????????????
- 在数据库中保存图片出错?
- 请问用delphi实现N阶层算法,要求用函数或者过程
- 为什么不能靠右边 ,好象被骗了?
- 请大家帮我改一下程序?!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- indy10中IDTCPClient怎么样在服务器端创建文件夹??
- 数据库问题!!!救命啊!
- 如果判断网络连接状态?
- 如何指定程序中日期或时间的显示格式呢?
- 挑战高手,寻求帮助:关于嵌入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系统的问题