⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_35943.htm

📁 一些关于vc的问答
💻 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&nbsp;&nbsp;&nbsp;&nbsp;dwStyle=0;<BR>/////////////////////////////////////////////////////////////////////////////<BR>// CHookdllApp initialization<BR><BR>LRESULT CALLBACK CallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam) <BR>{ <BR>&nbsp;&nbsp;&nbsp;&nbsp;LRESULT RetVal=CallNextHookEx(hCallWndprocRetHook, nCode,&nbsp;&nbsp;wParam, lParam); <BR>&nbsp;&nbsp;&nbsp;&nbsp;if (nCode &lt; 0) // do not process message <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return RetVal;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pCwpRetstruct=(CWPRETSTRUCT *)lParam;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(WM_GETTEXT==pCwpRetstruct-&gt;message)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwStyle=GetWindowLong(pCwpRetstruct-&gt;hwnd,GWL_STYLE);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(dwStyle&amp;ES_PASSWORD)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//问题在这里,我始终不能把 pCwpstruct-&gt;lParam 的内容读出来!<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::WritePrivateProfileString("fs","fsfg",(LPCTSTR)(pCwpRetstruct-&gt;lParam),"d:\\output\\d.ini");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;return RetVal;<BR>}<BR><BR>bool installhooker()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;//安装消息钩子<BR>&nbsp;&nbsp;&nbsp;&nbsp;hCallWndprocRetHook = SetWindowsHookEx(WH_CALLWNDPROCRET,CallWndRetProc,theApp.m_hInstance,0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(hCallWndprocRetHook==NULL)return 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;::AfxMessageBox("fs");<BR>&nbsp;&nbsp;&nbsp;&nbsp;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&nbsp;&nbsp;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 + -