﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-紫雨轩 C++-随笔分类-Win32 SDK</title><link>http://www.cppblog.com/rick/category/2232.html</link><description>技术交流</description><language>zh-cn</language><lastBuildDate>Wed, 21 May 2008 08:36:13 GMT</lastBuildDate><pubDate>Wed, 21 May 2008 08:36:13 GMT</pubDate><ttl>60</ttl><item><title>权限提升代码</title><link>http://www.cppblog.com/rick/archive/2007/08/22/30539.html</link><dc:creator>紫雨轩 C++</dc:creator><author>紫雨轩 C++</author><pubDate>Tue, 21 Aug 2007 16:04:00 GMT</pubDate><guid>http://www.cppblog.com/rick/archive/2007/08/22/30539.html</guid><wfw:comment>http://www.cppblog.com/rick/comments/30539.html</wfw:comment><comments>http://www.cppblog.com/rick/archive/2007/08/22/30539.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/rick/comments/commentRss/30539.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/rick/services/trackbacks/30539.html</trackback:ping><description><![CDATA[void&nbsp;AdjustPrivilege(int&nbsp;pid,&nbsp;BOOL&nbsp;bEnable)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;HANDLE&nbsp;&nbsp;&nbsp;&nbsp;hProcess;<br>&nbsp;&nbsp;HANDLE&nbsp;&nbsp;&nbsp;&nbsp;hToken=0;<br>&nbsp;&nbsp;&nbsp;&nbsp;TOKEN_PRIVILEGES&nbsp;tkp;<br>&nbsp;&nbsp;tkp.PrivilegeCount&nbsp;=&nbsp;1;&nbsp;&nbsp;<br>&nbsp;&nbsp;tkp.Privileges[0].Attributes&nbsp;=&nbsp;0;<br>&nbsp;&nbsp;if&nbsp;(bEnable)<br>&nbsp;&nbsp;&nbsp;&nbsp;tkp.Privileges[0].Attributes&nbsp;=&nbsp;SE_PRIVILEGE_ENABLED;<br>&nbsp;&nbsp;if&nbsp;(LookupPrivilegeValue(NULL,&nbsp;"SeDebugPrivilege",&nbsp;&amp;tkp.Privileges[0].Luid))<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(hProcess&nbsp;=&nbsp;OpenProcess(PROCESS_ALL_ACCESS,&nbsp;FALSE,&nbsp;pid))<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(OpenProcessToken(hProcess,&nbsp;TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&nbsp;&amp;hToken))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(AdjustTokenPrivileges(hToken,&nbsp;FALSE,&nbsp;&amp;tkp,&nbsp;0,&nbsp;NULL,&nbsp;NULL))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CloseHandle(hToken);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CloseHandle(hProcess);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;}<br>}<br>
<img src ="http://www.cppblog.com/rick/aggbug/30539.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/rick/" target="_blank">紫雨轩 C++</a> 2007-08-22 00:04 <a href="http://www.cppblog.com/rick/archive/2007/08/22/30539.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>防止注入的代码</title><link>http://www.cppblog.com/rick/archive/2007/08/22/30538.html</link><dc:creator>紫雨轩 C++</dc:creator><author>紫雨轩 C++</author><pubDate>Tue, 21 Aug 2007 16:03:00 GMT</pubDate><guid>http://www.cppblog.com/rick/archive/2007/08/22/30538.html</guid><wfw:comment>http://www.cppblog.com/rick/comments/30538.html</wfw:comment><comments>http://www.cppblog.com/rick/archive/2007/08/22/30538.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/rick/comments/commentRss/30538.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/rick/services/trackbacks/30538.html</trackback:ping><description><![CDATA[#define&nbsp;PROTECTED_DACL_SECURITY_INFORMATION&nbsp;(0x80000000L)<br><br>BOOL&nbsp;Lock_CurrentProcess()<br>{<br>&nbsp;&nbsp;HANDLE&nbsp;hProcess&nbsp;=&nbsp;::GetCurrentProcess();<br>&nbsp;&nbsp;SID_IDENTIFIER_AUTHORITY&nbsp;sia&nbsp;=&nbsp;SECURITY_WORLD_SID_AUTHORITY;<br>&nbsp;&nbsp;PSID&nbsp;pSid;<br>&nbsp;&nbsp;BOOL&nbsp;bSus&nbsp;=&nbsp;FALSE;<br>&nbsp;&nbsp;bSus&nbsp;=&nbsp;::AllocateAndInitializeSid(&amp;sia,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&amp;pSid);<br>&nbsp;&nbsp;if(!bSus)&nbsp;goto&nbsp;Cleanup;<br>&nbsp;&nbsp;HANDLE&nbsp;hToken;<br>&nbsp;&nbsp;bSus&nbsp;=&nbsp;::OpenProcessToken(hProcess,TOKEN_QUERY,&amp;hToken);<br>&nbsp;&nbsp;if(!bSus)&nbsp;goto&nbsp;Cleanup;<br>&nbsp;&nbsp;DWORD&nbsp;dwReturnLength;<br>&nbsp;&nbsp;::GetTokenInformation(hToken,TokenUser,NULL,NULL,&amp;dwReturnLength);<br>&nbsp;&nbsp;if(dwReturnLength&nbsp;&gt;&nbsp;0x400)&nbsp;goto&nbsp;Cleanup;<br>&nbsp;&nbsp;LPVOID&nbsp;TokenInformation;<br>&nbsp;&nbsp;TokenInformation&nbsp;=&nbsp;::LocalAlloc(LPTR,0x400);//这里就引用SDK的函数不引用CRT的了<br>&nbsp;&nbsp;DWORD&nbsp;dw;<br>&nbsp;&nbsp;bSus&nbsp;=&nbsp;::GetTokenInformation(hToken,TokenUser,TokenInformation,0x400,&amp;dw);<br>&nbsp;&nbsp;if(!bSus)&nbsp;goto&nbsp;Cleanup;<br>&nbsp;&nbsp;PTOKEN_USER&nbsp;pTokenUser&nbsp;=&nbsp;(PTOKEN_USER)TokenInformation;<br>&nbsp;&nbsp;BYTE&nbsp;Buf[0x200];<br>&nbsp;&nbsp;PACL&nbsp;pAcl&nbsp;=&nbsp;(PACL)&amp;Buf;<br>&nbsp;&nbsp;bSus&nbsp;=&nbsp;::InitializeAcl(pAcl,1024,ACL_REVISION);<br>&nbsp;&nbsp;if(!bSus)&nbsp;goto&nbsp;Cleanup;<br>&nbsp;&nbsp;bSus&nbsp;=&nbsp;::AddAccessDeniedAce(pAcl,ACL_REVISION,0x000000FA,pSid);<br>&nbsp;&nbsp;if(!bSus)&nbsp;goto&nbsp;Cleanup;<br>&nbsp;&nbsp;bSus&nbsp;=&nbsp;::AddAccessAllowedAce(pAcl,ACL_REVISION,0x00100701,pTokenUser-&gt;User.Sid);<br>&nbsp;&nbsp;if(!bSus)&nbsp;goto&nbsp;Cleanup;<br>&nbsp;&nbsp;if(::SetSecurityInfo(hProcess,SE_KERNEL_OBJECT,DACL_SECURITY_INFORMATION&nbsp;|&nbsp;PROTECTED_DACL_SECURITY_INFORMATION,NULL,NULL,pAcl,NULL)&nbsp;==&nbsp;0)<br>&nbsp;&nbsp;&nbsp;&nbsp;bSus&nbsp;=&nbsp;TRUE;<br>Cleanup:<br>&nbsp;&nbsp;if(hProcess&nbsp;!=&nbsp;NULL)<br>&nbsp;&nbsp;&nbsp;&nbsp;::CloseHandle(hProcess);<br>&nbsp;&nbsp;if(pSid&nbsp;!=&nbsp;NULL)<br>&nbsp;&nbsp;&nbsp;&nbsp;::FreeSid(pSid);<br>&nbsp;&nbsp;return&nbsp;bSus;<br>}<br><br>这段代码就可以锁住其他进程打开本进程,当然也就防止了注入,和读写内存.<br><br>可以更绝点Denied&nbsp;ALL&nbsp;ACCESS(0xFFFFFFFF)就连结束都不可能了<br><br>::AllocateAndInitializeSid&nbsp;可以换成&nbsp;::&nbsp;InitializeSid&nbsp;.因为我们并不需要初始化子Sid.<br>另外.<br>&nbsp;&nbsp;bSus&nbsp;=&nbsp;::AddAccessDeniedAce(pAcl,ACL_REVISION,0x000000FA,pSid);<br>&nbsp;&nbsp;if(!bSus)&nbsp;goto&nbsp;Cleanup;<br>&nbsp;&nbsp;bSus&nbsp;=&nbsp;::AddAccessAllowedAce(pAcl,ACL_REVISION,0x00100701,pTokenUser-&gt;User.Sid);<br>实际上只需要下面的一句,或者干脆把它去掉,因为如果不添加Ace默认就是没有权限.既然这样上面的那句话AllocateAndInitializeSid&nbsp;也可以省掉,也似乎有些多余 
<img src ="http://www.cppblog.com/rick/aggbug/30538.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/rick/" target="_blank">紫雨轩 C++</a> 2007-08-22 00:03 <a href="http://www.cppblog.com/rick/archive/2007/08/22/30538.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决Vista下文件名中带Update不能通过UAC认证的问题</title><link>http://www.cppblog.com/rick/archive/2007/08/21/30537.html</link><dc:creator>紫雨轩 C++</dc:creator><author>紫雨轩 C++</author><pubDate>Tue, 21 Aug 2007 15:58:00 GMT</pubDate><guid>http://www.cppblog.com/rick/archive/2007/08/21/30537.html</guid><wfw:comment>http://www.cppblog.com/rick/comments/30537.html</wfw:comment><comments>http://www.cppblog.com/rick/archive/2007/08/21/30537.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/rick/comments/commentRss/30537.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/rick/services/trackbacks/30537.html</trackback:ping><description><![CDATA[&lt;?xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"&nbsp;standalone="yes"?&gt;<br>&lt;assembly&nbsp;xmlns="urn:schemas-microsoft-com:asm.v1"&nbsp;manifestVersion="1.0"&gt;&nbsp;<br>&nbsp;&nbsp;&lt;assemblyIdentity&nbsp;version="1.0.0.0"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;processorArchitecture="X86"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name="IsUserAdmin"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type="win32"/&gt;&nbsp;<br>&nbsp;&nbsp;&lt;description&gt;QQUpdateCenter&lt;/description&gt;&nbsp;<br>&nbsp;&nbsp;&lt;!--&nbsp;Identify&nbsp;the&nbsp;application&nbsp;security&nbsp;requirements.&nbsp;--&gt;<br>&nbsp;&nbsp;&lt;trustInfo&nbsp;xmlns="urn:schemas-microsoft-com:asm.v2"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;security&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;requestedPrivileges&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;requestedExecutionLevel<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;level="asInvoker"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uiAccess="false"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/requestedPrivileges&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/security&gt;<br>&nbsp;&nbsp;&lt;/trustInfo&gt;<br>&lt;/assembly&gt;<br><br>这段代码放到manifest资源中。
<img src ="http://www.cppblog.com/rick/aggbug/30537.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/rick/" target="_blank">紫雨轩 C++</a> 2007-08-21 23:58 <a href="http://www.cppblog.com/rick/archive/2007/08/21/30537.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>utf8 编码方式 </title><link>http://www.cppblog.com/rick/archive/2006/07/15/9925.html</link><dc:creator>紫雨轩 C++</dc:creator><author>紫雨轩 C++</author><pubDate>Fri, 14 Jul 2006 17:13:00 GMT</pubDate><guid>http://www.cppblog.com/rick/archive/2006/07/15/9925.html</guid><wfw:comment>http://www.cppblog.com/rick/comments/9925.html</wfw:comment><comments>http://www.cppblog.com/rick/archive/2006/07/15/9925.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/rick/comments/commentRss/9925.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/rick/services/trackbacks/9925.html</trackback:ping><description><![CDATA[编码方式<br />编码方式<br />下面的字节串用来表示一个字符。用什么串依照该字符在 UCS 编码中的序号来定： <br />0x00000000 - 0x0000007F:<br />0xxxxxxx <br />0x00000080 - 0x000007FF:<br />110xxxxx 10xxxxxx <br />0x00000800 - 0x0000FFFF:<br />1110xxxx 10xxxxxx 10xxxxxx <br />0x00010000 - 0x001FFFFF:<br />11110xxx 10xxxxxx 10xxxxxx 10xxxxxx <br />0x00200000 - 0x03FFFFFF:<br />111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx <br />0x04000000 - 0x7FFFFFFF:<br />1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx <br />这里 xxx 的位置二进制位形式的字符编码填入。只用最短的那个足够表达一个字符编码数的多字节串。   <br /><br />举例说明<br />Unicode 字符 0xa9 = 1010 1001 (版权所有的符号) 在 UTF-8 中被编码为： <br /><br />11000010 10101001 = 0xc2 0xa9 <br />字符0x2260 = 0010 0010 0110 0000 (“不等于”符号)被编码为： <br /><br /><br />11100010 10001001 10100000 = 0xe2 0x89 0xa0 <br /><br /><br />''encode - 转成16进制符 <br /><br />For i = 1 To Len(strIN) <br />s = CStr(Hex(Asc(Mid(strIN, i, 1)))) ''是不是太~~~快了~~ <br />If Len(s) = 1 Then s = "0" &amp; s ''解出小于F的值就在前面加 0 <br />strOUT = strOUT &amp; "%" &amp; s <br />Next i <br /><br />txtOUT.Text = strOUT ''这里就是输出了 <br />___________________________________________________________ <br /><br />''decode - 解码, 比较麻烦点 <br /><br />For i = 1 To Len(strIN) Step 3 '' Step 3 因为格式是 %XX 三位一个字符 <br />s1 = UCase(Mid(strIN, i + 1, 1)) ''得到第2位的16进制数字 <br />s2 = UCase(Mid(strIN, i + 2, 1)) ''得到第1位的16进制数字 <br /><br />select Case s1 '' 进制转换 <br />Case "A" To "F" <br />n = (10 + 5 - (Asc("F") - Asc(s1))) * 16 <br />Case Else <br />n = Val(s1) * 16 <br />End select <br /><br />select Case s2 <br />Case "A" To "F" <br />n = n + (10 + 5 - (Asc("F") - Asc(s2))) <br />Case Else <br />n = n + Val(s2) <br />End select <br /><br />s = ChrW$(n) '' 转为字符 <br />strOUT = strOUT &amp; s <br />Next i <br />txtOUT.Text = strOUT <br />  <br /><br />怎么把字符串转成UTF-8格式？？？？  <br /> <br />下面的代码不成功：  <br />WCHAR  wstr[10];  <br />char  cstr[20];  <br />memset(  wstr,  0,  sizeof(wstr)  );  <br />MultiByteToWideChar(CP_UTF8,  0,  "我是小于",  -1,  wstr,  sizeof(wstr));  <br />WideCharToMultiByte(CP_ACP,  0,  wstr,  -1,  cstr,  -1,  "",  0);  <br /> <br />求助。。。。  <br />---------------------------------------------------------------  <br /> <br />int    main(void)      <br />{      <br />           char    str    [    256    ]    =    "唐志国"    ;        //一段UTF-8编码      <br />           WCHAR*    strA;      <br />           int    i=    MultiByteToWideChar    (  CP_ACP      ,    0    ,(char*)    str    ,-1    ,NULL,0);      <br />           strA    =    new    WCHAR[i];      <br />           MultiByteToWideChar    (    CP_ACP    ,    0    ,(    char    *    )    str,    -1,    strA    ,    i);      <br />             <br />           i=    WideCharToMultiByte(CP_UTF8,0,strA,-1,NULL,0,NULL,NULL);      <br />           char    *strB=new    char[i];      <br />           WideCharToMultiByte    (CP_UTF8,0,strA,-1,strB,i,NULL,NULL);      <br />           //strB即为所求      <br />           delete    []strA;      <br />           delete    []strB;      <br />           return    0;      <br />}      <br /> <br />---------------------------------------------------------------  <br /> <br />这是转换函数：  <br />           int            CodePageConvert(UINT  SrcCodePage,  LPCTSTR  pBuff,  int  iBuffLen,  UINT  DestCodePage,  char*  &amp;lpCodePage)  <br />           {  <br />                       int  iWideCharCnt  =  ::MultiByteToWideChar(SrcCodePage,  0,  pBuff,  iBuffLen,  NULL,  0);  <br />                       LPWSTR  lpszWideChar  =  new  wchar_t[iWideCharCnt  +  1];  <br />                       memset(lpszWideChar,  0,  (iWideCharCnt  +  1)  *  sizeof(WCHAR));  <br />                       iWideCharCnt  =  MultiByteToWideChar(SrcCodePage,  0,  pBuff,  iBuffLen,  lpszWideChar,  iWideCharCnt);  <br /> <br />                       if(DestCodePage  ==  54936    <br />                                               &amp;&amp;  !IsValidCodePage(54936))  <br />                                   DestCodePage  =  936;  <br /> <br />                       int  iDestCnt  =  WideCharToMultiByte(DestCodePage,  0,  lpszWideChar,  iWideCharCnt,  NULL,  0,  NULL,  NULL);  <br />                       lpCodePage  =  new  char[iDestCnt  +  1];  <br />                       memset(lpCodePage,  0,  iDestCnt  +  1);  <br />                       iDestCnt  =  WideCharToMultiByte(DestCodePage,  0,  lpszWideChar,  iWideCharCnt,  lpCodePage,  iDestCnt,  NULL,  NULL);  <br /> <br />                       delete  []lpszWideChar;              <br />                       return  iDestCnt;  <br />           }  <br />下面是调用方法：  <br />     utf-8  到  gbk  <br />           int  nLen  =  CodePageConvertUnix("UTF-8",_T("标准"),2,"GBK",lpOut);  <br />     gbk  到utf-8  <br />int  nLen  =  CodePageConvertUnix("UTF-8",_T("标准"),2,"GBK",lpOut);  <br /> <br /><img src ="http://www.cppblog.com/rick/aggbug/9925.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/rick/" target="_blank">紫雨轩 C++</a> 2006-07-15 01:13 <a href="http://www.cppblog.com/rick/archive/2006/07/15/9925.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC中有没有DoEvents类似的函数? </title><link>http://www.cppblog.com/rick/archive/2006/07/15/9921.html</link><dc:creator>紫雨轩 C++</dc:creator><author>紫雨轩 C++</author><pubDate>Fri, 14 Jul 2006 17:05:00 GMT</pubDate><guid>http://www.cppblog.com/rick/archive/2006/07/15/9921.html</guid><wfw:comment>http://www.cppblog.com/rick/comments/9921.html</wfw:comment><comments>http://www.cppblog.com/rick/archive/2006/07/15/9921.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/rick/comments/commentRss/9921.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/rick/services/trackbacks/9921.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">使用这样的函数： <br />    BOOL CheckMessageQueue() <br />    { <br />     MSG msg; <br />     <br />     </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">(PeekMessage(</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">msg, NULL, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, PM_REMOVE)){ <br />     </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">(msg.message</span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000">WM_QUIT) <br />     </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> FALSE; <br />     TranslateMessage(</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">msg); <br />     DispatchMessage(</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">msg); <br />     } <br />     </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> TRUE; <br />    } <br />    <br /></span>
		</div>该函数可以实现DoEvents的效果。但有一点不同，如果该函数返回FALSE，说明用户按下了关闭按钮。 <br /><img src ="http://www.cppblog.com/rick/aggbug/9921.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/rick/" target="_blank">紫雨轩 C++</a> 2006-07-15 01:05 <a href="http://www.cppblog.com/rick/archive/2006/07/15/9921.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>获取指定内存所在的模块、当前模块、当前函数的返回模块</title><link>http://www.cppblog.com/rick/archive/2006/07/15/9920.html</link><dc:creator>紫雨轩 C++</dc:creator><author>紫雨轩 C++</author><pubDate>Fri, 14 Jul 2006 17:04:00 GMT</pubDate><guid>http://www.cppblog.com/rick/archive/2006/07/15/9920.html</guid><wfw:comment>http://www.cppblog.com/rick/comments/9920.html</wfw:comment><comments>http://www.cppblog.com/rick/archive/2006/07/15/9920.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/rick/comments/commentRss/9920.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/rick/services/trackbacks/9920.html</trackback:ping><description><![CDATA[利用一个函数VirtualQuery可以获取指定内存所在的模块：<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">inline HMODULE GetModuleFromAddr(PVOID p)<br />{ <br />    MEMORY_BASIC_INFORMATION m </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> { </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000"> };<br />    VirtualQuery(p, </span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">m, </span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000">(MEMORY_BASIC_INFORMATION));<br />    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> (HMODULE) m.AllocationBase;<br />}<br /></span></div><br />有了上面的函数，就非常容易获取当前模块的句柄（比如在静态LIB链接到DLL的项目中，需要知道模块句柄的情况）：<br /><br />HMODULE hThisModule = GetModuleFromAddr(当前模块中的任意函数或变量地址);<br /><br />更进一步的应用，假如我们需要知道那个模块在调用自己，可以结合_ReturnAddress() intrinsic来实现：<br /><br />全局声明：EXTERN_C PVOID _ReturnAddress();<br /><br />调用：HMODULE hCallerModule = GetModuleFromAddr(_ReturnAddress());<br /><br /><br /><img src ="http://www.cppblog.com/rick/aggbug/9920.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/rick/" target="_blank">紫雨轩 C++</a> 2006-07-15 01:04 <a href="http://www.cppblog.com/rick/archive/2006/07/15/9920.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>加载DLL注入到目标进程 </title><link>http://www.cppblog.com/rick/archive/2006/07/15/9919.html</link><dc:creator>紫雨轩 C++</dc:creator><author>紫雨轩 C++</author><pubDate>Fri, 14 Jul 2006 17:03:00 GMT</pubDate><guid>http://www.cppblog.com/rick/archive/2006/07/15/9919.html</guid><wfw:comment>http://www.cppblog.com/rick/comments/9919.html</wfw:comment><comments>http://www.cppblog.com/rick/archive/2006/07/15/9919.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/rick/comments/commentRss/9919.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/rick/services/trackbacks/9919.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">DWORD Bind(HANDLE hProcess, PCTSTR ptzPath)<br />{ <br />    DWORD dwResult </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />    PVOID pvRemote </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> NULL;<br />    HANDLE hThread </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> NULL;<br />    </span>
				<span style="COLOR: #0000ff">do</span>
				<span style="COLOR: #000000">
						<br />    { <br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (hProcess </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> NULL)<br />        { <br />            dwResult </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />            </span>
				<span style="COLOR: #0000ff">break</span>
				<span style="COLOR: #000000">;<br />        }<br /><br />        DWORD dwSize </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">(lstrlen(ptzPath) </span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">) </span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">sizeof</span>
				<span style="COLOR: #000000">(TCHAR);<br />        pvRemote </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> VirtualAllocEx(hProcess, NULL, dwSize, MEM_COMMIT, PAGE_READWRITE);<br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (pvRemote </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> NULL)<br />        { <br />            dwResult </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">;<br />            </span>
				<span style="COLOR: #0000ff">break</span>
				<span style="COLOR: #000000">;<br />        }<br /><br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (</span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000">WriteProcessMemory(hProcess, pvRemote, ptzPath, dwSize, NULL))<br />        { <br />            dwResult </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">3</span>
				<span style="COLOR: #000000">;<br />            </span>
				<span style="COLOR: #0000ff">break</span>
				<span style="COLOR: #000000">;<br />        }<br /><br />        PTHREAD_START_ROUTINE pfnLoadLibraryW </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> <br />            (PTHREAD_START_ROUTINE) GetProcAddress(GetModuleHandle(TEXT(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">Kernel32.dll</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">)), STR_LoadLibrary);<br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (pfnLoadLibraryW </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> NULL)<br />        { <br />            dwResult </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">;<br />            </span>
				<span style="COLOR: #0000ff">break</span>
				<span style="COLOR: #000000">;<br />        }<br /><br />        hThread </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> CreateRemoteThread(hProcess, NULL, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, pfnLoadLibraryW, pvRemote, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, NULL);<br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (hThread </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> NULL)<br />        { <br />            dwResult </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">;<br />            </span>
				<span style="COLOR: #0000ff">break</span>
				<span style="COLOR: #000000">;<br />        }<br /><br />        WaitForSingleObject(hThread, INFINITE);<br />    }<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000"> (FALSE);<br /><br />    </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (hThread)<br />    { <br />        CloseHandle(hThread);<br />    }<br />    </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (pvRemote)<br />    { <br />        VirtualFreeEx(hProcess, pvRemote, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, MEM_RELEASE);<br />    }<br />    </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (hProcess)<br />    { <br />        CloseHandle(hProcess);<br />    }<br /><br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> dwResult;<br />}<br /></span>
		</div>
<img src ="http://www.cppblog.com/rick/aggbug/9919.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/rick/" target="_blank">紫雨轩 C++</a> 2006-07-15 01:03 <a href="http://www.cppblog.com/rick/archive/2006/07/15/9919.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>get the PIII processor serial number (psn) </title><link>http://www.cppblog.com/rick/archive/2006/07/15/9915.html</link><dc:creator>紫雨轩 C++</dc:creator><author>紫雨轩 C++</author><pubDate>Fri, 14 Jul 2006 16:57:00 GMT</pubDate><guid>http://www.cppblog.com/rick/archive/2006/07/15/9915.html</guid><wfw:comment>http://www.cppblog.com/rick/comments/9915.html</wfw:comment><comments>http://www.cppblog.com/rick/archive/2006/07/15/9915.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/rick/comments/commentRss/9915.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/rick/services/trackbacks/9915.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">CString GetProcessorSeialNumbet(</span>
				<span style="COLOR: #0000ff">bool</span>
				<span style="COLOR: #000000"> withSeparator)<br />{<br />DWORD  t,m,b; </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">top,middle,botttom</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">DWORD</span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000"> serial;<br />  _asm<br />  {<br />    mov   eax,</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">programmer: I need a Service ?<br />         </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">processor: what type baby?<br />      </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">eax = 3 --&gt; <br />       </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">eax: top 32 bits are the processor signature bits<br />         <br /><br />       </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">programmer:this</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">    cpuid     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">_emit 0x0f |cpuid mean this tow instruction<br />          </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">_emit 0xa2 |instead of writing them <br />       </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">       <br />    </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">mean:the sevice i want the processor serial number</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">
						<br /> mov   t,eax </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> top 32 bits are the processor signature bits</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">           </span>
				<span style="COLOR: #008000">/*</span>
				<span style="COLOR: #008000"> <br />          eax = 3 --&gt; <br />        ecx: middle 32 bits are the processor signature bits<br />         edx: bottom 32 bits are the processor signature bits<br />      </span>
				<span style="COLOR: #008000">*/</span>
				<span style="COLOR: #000000">
						<br />    mov   eax,</span>
				<span style="COLOR: #000000">3</span>
				<span style="COLOR: #000000">
						<br />    cpuid<br />    mov   m,edx</span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> middle 32 bits are the processor signature bits</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">    mov   b,ecx</span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> bottom 32 bits are the processor signature bits</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">  }<br /><br />  </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> copy the locals into the pointer variables passed in</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">  serial[</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">] </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> b;<br />  serial[</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">] </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> m;<br />  serial[</span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">] </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> t;<br /><br /><br />CString temp,SN;<br />SN.Empty();<br /></span>
				<span style="COLOR: #0000ff">static</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">char</span>
				<span style="COLOR: #000000"> hex_chars[</span>
				<span style="COLOR: #000000">16</span>
				<span style="COLOR: #000000">] </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> {</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">3</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">6</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">7</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,<br />                 </span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">8</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">9</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">A</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">B</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">C</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">D</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">E</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">F</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">};<br /></span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000"> (</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> dw_count </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">; dw_count</span>
				<span style="COLOR: #000000">&gt;=</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; dw_count</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000">)<br />  {<br />    </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000"> (</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> bp</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">28</span>
				<span style="COLOR: #000000">; bp</span>
				<span style="COLOR: #000000">&gt;=</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; bp</span>
				<span style="COLOR: #000000">-=</span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">)<br />    {<br />      DWORD nibble </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> (serial[dw_count] </span>
				<span style="COLOR: #000000">&gt;&gt;</span>
				<span style="COLOR: #000000"> bp) </span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0x0f</span>
				<span style="COLOR: #000000">;<br />      temp.Format(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%c</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, hex_chars[nibble]);<br />   SN</span>
				<span style="COLOR: #000000">+=</span>
				<span style="COLOR: #000000">temp;<br />      </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> ((bp </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">16</span>
				<span style="COLOR: #000000">) </span>
				<span style="COLOR: #000000">||</span>
				<span style="COLOR: #000000"> ((bp </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">) </span>
				<span style="COLOR: #000000">&amp;&amp;</span>
				<span style="COLOR: #000000"> (dw_count</span>
				<span style="COLOR: #000000">!=</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">)) )<br />    </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">(withSeparator)SN</span>
				<span style="COLOR: #000000">+=</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">;<br />    }<br />  }<br /> </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> SN;<br />}<br /></span>
		</div>
<img src ="http://www.cppblog.com/rick/aggbug/9915.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/rick/" target="_blank">紫雨轩 C++</a> 2006-07-15 00:57 <a href="http://www.cppblog.com/rick/archive/2006/07/15/9915.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GetActiveWindow函数GetForegroundWindow  </title><link>http://www.cppblog.com/rick/archive/2006/07/15/9914.html</link><dc:creator>紫雨轩 C++</dc:creator><author>紫雨轩 C++</author><pubDate>Fri, 14 Jul 2006 16:51:00 GMT</pubDate><guid>http://www.cppblog.com/rick/archive/2006/07/15/9914.html</guid><wfw:comment>http://www.cppblog.com/rick/comments/9914.html</wfw:comment><comments>http://www.cppblog.com/rick/archive/2006/07/15/9914.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/rick/comments/commentRss/9914.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/rick/services/trackbacks/9914.html</trackback:ping><description><![CDATA[GetActiveWindow返回线程的活动窗口，而不是系统的活动窗口。如果要得到用户正在激活的窗口，应该使用 GetForegroundWindow。 <br /><img src ="http://www.cppblog.com/rick/aggbug/9914.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/rick/" target="_blank">紫雨轩 C++</a> 2006-07-15 00:51 <a href="http://www.cppblog.com/rick/archive/2006/07/15/9914.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>