﻿<?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++世界-随笔分类-常用编程小例</title><link>http://www.cppblog.com/fdsajhg/category/14716.html</link><description>管理系统--&lt;</description><language>zh-cn</language><lastBuildDate>Sun, 26 Sep 2010 10:02:58 GMT</lastBuildDate><pubDate>Sun, 26 Sep 2010 10:02:58 GMT</pubDate><ttl>60</ttl><item><title>--内存搜索内容--</title><link>http://www.cppblog.com/fdsajhg/archive/2010/08/29/125147.html</link><dc:creator>傅先生</dc:creator><author>傅先生</author><pubDate>Sun, 29 Aug 2010 03:50:00 GMT</pubDate><guid>http://www.cppblog.com/fdsajhg/archive/2010/08/29/125147.html</guid><wfw:comment>http://www.cppblog.com/fdsajhg/comments/125147.html</wfw:comment><comments>http://www.cppblog.com/fdsajhg/archive/2010/08/29/125147.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fdsajhg/comments/commentRss/125147.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fdsajhg/services/trackbacks/125147.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: //&nbsp;getQQpassword.cpp&nbsp;:&nbsp;Defines&nbsp;the&nbsp;entry&nbsp;point&nbsp;for&nbsp;the&nbsp;DLL&nbsp;application.//#include&nbsp;&quot;stdafx.h&quot;#include&nbsp;&nbsp;&lt;string&gt;...&nbsp;&nbsp;<a href='http://www.cppblog.com/fdsajhg/archive/2010/08/29/125147.html'>阅读全文</a><img src ="http://www.cppblog.com/fdsajhg/aggbug/125147.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fdsajhg/" target="_blank">傅先生</a> 2010-08-29 11:50 <a href="http://www.cppblog.com/fdsajhg/archive/2010/08/29/125147.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>需要完成的-------编程小例</title><link>http://www.cppblog.com/fdsajhg/archive/2010/08/28/124995.html</link><dc:creator>傅先生</dc:creator><author>傅先生</author><pubDate>Fri, 27 Aug 2010 21:59:00 GMT</pubDate><guid>http://www.cppblog.com/fdsajhg/archive/2010/08/28/124995.html</guid><wfw:comment>http://www.cppblog.com/fdsajhg/comments/124995.html</wfw:comment><comments>http://www.cppblog.com/fdsajhg/archive/2010/08/28/124995.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fdsajhg/comments/commentRss/124995.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fdsajhg/services/trackbacks/124995.html</trackback:ping><description><![CDATA[<br>枚举类<br>1，注册表<br>2，文件<br>3，<br>4，<br>5，<br><br>搜索类<br>1，内存<br>2，文件<br>3，注册表<br>4，<br>5
<img src ="http://www.cppblog.com/fdsajhg/aggbug/124995.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fdsajhg/" target="_blank">傅先生</a> 2010-08-28 05:59 <a href="http://www.cppblog.com/fdsajhg/archive/2010/08/28/124995.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>枚举windows窗口函数</title><link>http://www.cppblog.com/fdsajhg/archive/2010/08/28/124994.html</link><dc:creator>傅先生</dc:creator><author>傅先生</author><pubDate>Fri, 27 Aug 2010 21:56:00 GMT</pubDate><guid>http://www.cppblog.com/fdsajhg/archive/2010/08/28/124994.html</guid><wfw:comment>http://www.cppblog.com/fdsajhg/comments/124994.html</wfw:comment><comments>http://www.cppblog.com/fdsajhg/archive/2010/08/28/124994.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fdsajhg/comments/commentRss/124994.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fdsajhg/services/trackbacks/124994.html</trackback:ping><description><![CDATA[<code><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">///////////////1，枚举主体窗口<br>///////////////2，枚举窗体类下的子窗口</font></code><code><font style="FONT: 10pt Fixedsys; COLOR: #0000ff"><br><br><br>#include&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">&lt;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">Stdio</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">.</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">h</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">&gt;<br></font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">#include&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">&lt;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">Windows</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">.</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">h</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">&gt;<br><br></font><font style="FONT: 10pt Fixedsys; COLOR: #000000">BOOL&nbsp;CALLBACK&nbsp;EnumWindowsProc</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HWND&nbsp;hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">LPARAM&nbsp;lParam</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br></font><font style="FONT: 10pt Fixedsys; COLOR: #000000">BOOL&nbsp;CALLBACK&nbsp;EnumChildProc</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HWND&nbsp;hwnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">LPARAM&nbsp;lParam&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br><br></font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">int&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">main</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">int&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">argc</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">char</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">*&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">argv</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">[]&nbsp;)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HWND&nbsp;m_htest&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">=&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">FindWindow</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"TXGuiFoundation"</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">NULL</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);</font><font style="FONT: 10pt Comic Sans MS; COLOR: #008000">//(1,lpclassname&nbsp;2,lpwindowsname)<br>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;EnumWindows(&nbsp;EnumWindowsProc,&nbsp;NULL&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">if</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">m_htest</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">==</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">NULL</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">printf</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"No&nbsp;find&nbsp;something!!\n"</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">EnumChildWindows</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">m_htest</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">EnumChildProc</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">NULL</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">return&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">0</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br>}<br><br></font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HWND&nbsp;m_hwndFind</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">[</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">1000</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">]&nbsp;=&nbsp;{</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">0</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">};<br></font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">int&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">m_num&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">=&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">0</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br><br><br></font><font style="FONT: 10pt Fixedsys; COLOR: #000000">BOOL&nbsp;CALLBACK&nbsp;EnumChildProc</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HWND&nbsp;hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">LPARAM&nbsp;lParam&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Comic Sans MS; COLOR: #008000">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(::GetWindowLong(hWnd,GWL_STYLE)&nbsp;&amp;&nbsp;WS_VISIBLE)<br>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">char&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">sBuf</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">[</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">256</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">];<br>&nbsp;&nbsp;&nbsp;&nbsp;::</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">GetClassName</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">NULL</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">254</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br></font><font style="FONT: 10pt Comic Sans MS; COLOR: #008000">//&nbsp;&nbsp;&nbsp;&nbsp;::GetWindowText(aHwnd,WndCaption,254);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">::</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">GetWindowText</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">sBuf</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">256&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">printf</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"%s\n"</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">sBuf&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">m_hwndFind</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">[</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">m_num</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">]&nbsp;=&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">m_num</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">++;<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Comic Sans MS; COLOR: #008000">//&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">return&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">1</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>}<br><br><br><br></font><font style="FONT: 10pt Fixedsys; COLOR: #000000">BOOL&nbsp;CALLBACK&nbsp;EnumWindowsProc</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HWND&nbsp;hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">LPARAM&nbsp;lParam</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">if</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(::</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">GetWindowLong</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">GWL_STYLE</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)&nbsp;&amp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">WS_VISIBLE</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">char&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">sBuf</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">[</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">256</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Comic Sans MS; COLOR: #008000">//获取窗口标题<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">::</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">GetWindowText</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">sBuf</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">256&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">if&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">strcmp</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">sBuf</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"我的电脑"&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)&nbsp;==&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">0&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Comic Sans MS; COLOR: #008000">//在发现我的电脑时设置其标题为www.a3gs.com<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">::</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">SetWindowText</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"www.a3gs.com"&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">printf</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"%s\n"</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">sBuf&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">m_hwndFind</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">[</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">m_num</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">]&nbsp;=&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">m_num</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">++;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">return&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">1</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br>}<br><br>/////////////////////////////////////////////////<br><br><br><br><font color=#0000ff>#include&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">&lt;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">windows</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">.</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">h</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">&gt;<br></font><font style="FONT: 10pt Fixedsys; COLOR: #000000">BOOL&nbsp;CALLBACK&nbsp;EnumChildProc</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HWND&nbsp;hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">LPARAM&nbsp;lParam</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br></font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">int&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">WINAPI&nbsp;WinMain</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HINSTANCE&nbsp;hInstance</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HINSTANCE&nbsp;hPrevInstance</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">LPSTR&nbsp;lpCmdLine</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">int&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">nCmdShow</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">char&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">className</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">[]=</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"TXGuiFoundation"</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HWND&nbsp;hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">=::</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">FindWindow</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">className</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">NULL</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">if</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">EnumChildWindows</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">EnumChildProc</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">0</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">return&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">0</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">MessageBox</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">NULL</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"fail!"</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"fail"</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">MB_OK</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">return&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">0</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br>}<br><br><br></font><font style="FONT: 10pt Fixedsys; COLOR: #000000">BOOL&nbsp;CALLBACK&nbsp;EnumChildProc</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">HWND&nbsp;hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">LPARAM&nbsp;lParam</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">char&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">temp1</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">[</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">256</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">],</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">temp2</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">[</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">256</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">];<br>&nbsp;&nbsp;&nbsp;&nbsp;::</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">GetWindowText</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">temp1</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #800080">255</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">wsprintf</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">temp2</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"hwnd:%x&nbsp;text:&nbsp;%s"</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">hWnd</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">temp1</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">MessageBox</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">(</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">NULL</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">temp2</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #808080">"cwnd"</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">,</font><font style="FONT: 10pt Fixedsys; COLOR: #000000">MB_OK</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">);<br>&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="FONT: 10pt Fixedsys; COLOR: #0000ff">return&nbsp;true</font><font style="FONT: 10pt Fixedsys; COLOR: #000080">;<br>}</font><font color=#000000 size=3> </font><br><code><font style="FONT: 10pt Fixedsys; COLOR: #0000ff"><br></font></code></font></code>
<img src ="http://www.cppblog.com/fdsajhg/aggbug/124994.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fdsajhg/" target="_blank">傅先生</a> 2010-08-28 05:56 <a href="http://www.cppblog.com/fdsajhg/archive/2010/08/28/124994.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>常用--代码小例</title><link>http://www.cppblog.com/fdsajhg/archive/2010/08/24/124498.html</link><dc:creator>傅先生</dc:creator><author>傅先生</author><pubDate>Mon, 23 Aug 2010 22:57:00 GMT</pubDate><guid>http://www.cppblog.com/fdsajhg/archive/2010/08/24/124498.html</guid><wfw:comment>http://www.cppblog.com/fdsajhg/comments/124498.html</wfw:comment><comments>http://www.cppblog.com/fdsajhg/archive/2010/08/24/124498.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fdsajhg/comments/commentRss/124498.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fdsajhg/services/trackbacks/124498.html</trackback:ping><description><![CDATA[<p>1，查找代码.c<br>2，枚举窗口<br>3，枚举进程 <br>///////////////////////////内存&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 枚举，搜索<br>///////////////////////////注册表<br>///////////////////////////服务<br>///////////////////////////图像<br>//////////////////////////////////格式集<br><br><br>//////////////////////////////////驱动--------HOOK？<br>/////////////////////////////////代码，比较，<br><br>//1，查找代码.c<br>/* READ.C: This program opens a file named<br>&nbsp;* READ.C and tries to read 60,000 bytes from<br>&nbsp;* that file using _read. It then displays the<br>&nbsp;* actual number of bytes read from READ.C.<br>&nbsp;*/</p>
<p>#include &lt;fcntl.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Needed only for _O_RDWR definition */<br>#include &lt;io.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;stdio.h&gt;</p>
<p>char buffer[60000];</p>
<p>void main( void )<br>{<br>&nbsp;&nbsp; int fh;<br>&nbsp;&nbsp; unsigned int nbytes = 60000, bytesread;</p>
<p>&nbsp;&nbsp; /* Open file for input: */<br>&nbsp;&nbsp; if( (fh = _open( "read.c", _O_RDONLY )) == -1 )<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; perror( "open failed on input file" );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit( 1 );<br>&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp; /* Read in input: */<br>&nbsp;&nbsp; if( ( bytesread = _read( fh, buffer, nbytes ) ) &lt;= 0 )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; perror( "Problem reading file" );<br>&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf( "Read %u bytes from file\n", bytesread );</p>
<p>&nbsp;&nbsp; _close( fh );<br>}<br></p>
<p><br><br>//2，枚举窗口<br>&nbsp;#include &lt;Stdio.h&gt;<br>#include &lt;Windows.h&gt;</p>
<p>BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);<br>BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam );</p>
<p>int main( int argc, char* argv[] )<br>{<br>&nbsp;HWND m_htest = FindWindow("TXGuiFoundation",NULL);//(1,lpclassname 2,lpwindowsname)<br>&nbsp;//&nbsp;&nbsp; EnumWindows( EnumWindowsProc, NULL );<br>&nbsp;if(m_htest==NULL)<br>&nbsp;{<br>&nbsp;&nbsp;printf("No find something!!\n");<br>&nbsp;}<br>&nbsp;<br>&nbsp;EnumChildWindows(m_htest,EnumChildProc,NULL);<br>&nbsp;return 0;<br>}</p>
<p>HWND m_hwndFind[1000] = {0};<br>int&nbsp; m_num = 0;</p>
<p><br>BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam )<br>{<br>&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(::GetWindowLong(hWnd,GWL_STYLE) &amp; WS_VISIBLE)<br>&nbsp;//&nbsp;&nbsp; {<br>&nbsp;<br>&nbsp;char sBuf[256];<br>&nbsp;::GetClassName(hWnd,NULL,254);<br>//&nbsp;::GetWindowText(aHwnd,WndCaption,254);<br>&nbsp;::GetWindowText( hWnd, sBuf, 256 );<br>&nbsp;printf( "%s\n", sBuf );<br>&nbsp;m_hwndFind[m_num] = hWnd;<br>&nbsp;m_num++;<br>&nbsp;//&nbsp; }<br>&nbsp;return 1;<br>&nbsp;<br>}</p>
<p>&nbsp;</p>
<p>BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)<br>{<br>&nbsp;if(::GetWindowLong(hWnd,GWL_STYLE) &amp; WS_VISIBLE)<br>&nbsp;{<br>&nbsp;&nbsp;char sBuf[256];<br>&nbsp;&nbsp;//获取窗口标题<br>&nbsp;&nbsp;::GetWindowText( hWnd, sBuf, 256 );<br>&nbsp;&nbsp;if ( strcmp( sBuf, "我的电脑" ) == 0 )<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;//在发现我的电脑时设置其标题为<a href="http://www.a3gs.com/">www.a3gs.com</a><br>&nbsp;&nbsp;&nbsp;::SetWindowText( hWnd, "<a href="http://www.a3gs.com/">www.a3gs.com</a>" );<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;printf( "%s\n", sBuf );<br>&nbsp;&nbsp;m_hwndFind[m_num] = hWnd;<br>&nbsp;&nbsp;m_num++;<br>&nbsp;}<br>&nbsp;return 1;<br>}<br><br>//3，枚举进程 <br></p>

<code><font style="font: 10pt Fixedsys; color: #0000FF; ">#include&nbsp;</font><font style="font: 10pt Fixedsys; color: #000080; ">&lt;</font><font style="font: 10pt Fixedsys; color: #000000; ">windows</font><font style="font: 10pt Fixedsys; color: #000080; ">.</font><font style="font: 10pt Fixedsys; color: #000000; ">h</font><font style="font: 10pt Fixedsys; color: #000080; ">&gt;<br>
</font><font style="font: 10pt Fixedsys; color: #0000FF; ">#include&nbsp;</font><font style="font: 10pt Fixedsys; color: #000080; ">&lt;</font><font style="font: 10pt Fixedsys; color: #000000; ">tlhelp32</font><font style="font: 10pt Fixedsys; color: #000080; ">.</font><font style="font: 10pt Fixedsys; color: #000000; ">h</font><font style="font: 10pt Fixedsys; color: #000080; ">&gt;<br>
</font><font style="font: 10pt Fixedsys; color: #0000FF; ">#include&nbsp;</font><font style="font: 10pt Fixedsys; color: #000080; ">&lt;</font><font style="font: 10pt Fixedsys; color: #000000; ">iostream</font><font style="font: 10pt Fixedsys; color: #000080; ">&gt;&nbsp;<br>
<br>
<br>
</font><font style="font: 10pt Fixedsys; color: #0000FF; ">#pragma&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">comment</font><font style="font: 10pt Fixedsys; color: #000080; ">(&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">linker</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;/subsystem:\&quot;windows\&quot;&nbsp;/entry:\&quot;mainCRTStartup\&quot;&quot;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000080; ">)<br>
</font><font style="font: 10pt Fixedsys; color: #0000FF; ">int&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">main</font><font style="font: 10pt Fixedsys; color: #000080; ">(&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Comic Sans MS; color: #008000; ">//&nbsp;现在我们将利用函数CreateToolhelp32Snapshot()获得当前运行进程的快照<br>
&nbsp;&nbsp;&nbsp;&nbsp;//这个函数返回包含正在运行进程的快照句柄。<br>
&nbsp;&nbsp;&nbsp;&nbsp;//他的原形是：<br>
&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;HANDLE&nbsp;WINAPI&nbsp;CreateToolhelp32Snapshot(DWORD&nbsp;dwFlags,&nbsp;DWORD&nbsp;th32ProcessID);<br>
&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;我们将dwFlags设为TH32CS_SNAPPROCESS，th32ProcessID置为0。<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">HANDLE&nbsp;hSnapShot</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #000000; ">CreateToolhelp32Snapshot</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">TH32CS_SNAPPROCESS</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #800080; ">0</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Comic Sans MS; color: #008000; ">//现在我们获得了所有进程的信息。<br>
&nbsp;&nbsp;&nbsp;&nbsp;//将从hSnapShot中抽取数据到一个PROCESSENTRY32结构中<br>
&nbsp;&nbsp;&nbsp;&nbsp;//这个结构代表了一个进程，是ToolHelp32&nbsp;API的一部分。<br>
&nbsp;&nbsp;&nbsp;&nbsp;//抽取数据靠Process32First()和Process32Next()这两个函数。<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;//这里我们仅用Process32Next()，他的原形是：<br>
&nbsp;&nbsp;&nbsp;&nbsp;//BOOL&nbsp;WINAPI&nbsp;Process32Next(HANDLE&nbsp;hSnapshot,LPPROCESSENTRY32&nbsp;lppe);<br>
&nbsp;&nbsp;&nbsp;&nbsp;//我们程序的代码中加入：<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">PROCESSENTRY32</font><font style="font: 10pt Fixedsys; color: #000080; ">*&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #0000FF; ">new&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">PROCESSENTRY32</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Comic Sans MS; color: #008000; ">//&nbsp;必须设置PROCESSENTRY32的dwSize成员的值&nbsp;;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">dwSize</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #0000FF; ">sizeof</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">PROCESSENTRY32</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">int&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">index</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #800080; ">0</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Comic Sans MS; color: #008000; ">//这里我们将快照句柄和PROCESSENTRY32结构传给Process32Next()。<br>
&nbsp;&nbsp;&nbsp;&nbsp;//执行之后，PROCESSENTRY32&nbsp;结构将获得进程的信息。我们循环遍历，直到函数返回FALSE。<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;****************开始列举进程****************\n&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">while</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">Process32Next</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">hSnapShot</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">)!=</font><font style="font: 10pt Fixedsys; color: #000000; ">FALSE</font><font style="font: 10pt Fixedsys; color: #000080; ">)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">index</font><font style="font: 10pt Fixedsys; color: #000080; ">++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;******************&nbsp;%d&nbsp;******************\n&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">index</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;PID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Current&nbsp;Threads\n&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;%-15d%-25s%-4d\n&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">th32ProcessID</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">szExeFile</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">cntThreads</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">if</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">strcmp</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">szExeFile</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;XsMenu.exe&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">)==</font><font style="font: 10pt Fixedsys; color: #800080; ">0&nbsp;</font><font style="font: 10pt Fixedsys; color: #000080; ">||</font><font style="font: 10pt Fixedsys; color: #000000; ">strcmp</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">szExeFile</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;xsmenu.exe&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">)==</font><font style="font: 10pt Fixedsys; color: #800080; ">0</font><font style="font: 10pt Fixedsys; color: #000080; ">)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">HANDLE&nbsp;hProcess2</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #000000; ">OpenProcess</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">PROCESS_ALL_ACCESS</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">TRUE</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">th32ProcessID</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">HEAPENTRY32</font><font style="font: 10pt Fixedsys; color: #000080; ">*&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">heapInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #0000FF; ">new&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">HEAPENTRY32</font><font style="font: 10pt Fixedsys; color: #000080; ">;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">heapInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">dwSize</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #0000FF; ">sizeof</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">HEAPENTRY32</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;******开始列举Heap****\n&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">int&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">indexNum</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #800080; ">0</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">while</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">Heap32Next</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">heapInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">)!=</font><font style="font: 10pt Fixedsys; color: #000000; ">FALSE</font><font style="font: 10pt Fixedsys; color: #000080; ">)</font><font style="font: 10pt Comic Sans MS; color: #008000; ">//<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000080; ">{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">indexNum</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #800080; ">0</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;******************&nbsp;%d&nbsp;******************\n&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">index</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;PID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Current&nbsp;Threads\n&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;%x-15x%-25s%-4d\n&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">heapInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">dwAddress</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">heapInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">dwSize</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">heapInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">th32ProcessID</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Comic Sans MS; color: #008000; ">//&nbsp;现在我们用函数&nbsp;TerminateProcess()终止进程：<br>
&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;这里我们用PROCESS_ALL_ACCESS<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">int&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">processID</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">HANDLE&nbsp;hProcess</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">hProcess</font><font style="font: 10pt Fixedsys; color: #000080; ">=</font><font style="font: 10pt Fixedsys; color: #000000; ">OpenProcess</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">PROCESS_ALL_ACCESS</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">TRUE</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">-&gt;</font><font style="font: 10pt Fixedsys; color: #000000; ">th32ProcessID</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">if</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">hProcess</font><font style="font: 10pt Fixedsys; color: #000080; ">==</font><font style="font: 10pt Fixedsys; color: #000000; ">NULL</font><font style="font: 10pt Fixedsys; color: #000080; ">)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;Unable&nbsp;to&nbsp;get&nbsp;handle&nbsp;of&nbsp;process:&nbsp;&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;Error&nbsp;is:&nbsp;%d&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">GetLastError</font><font style="font: 10pt Fixedsys; color: #000080; ">());<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">TerminateProcess</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">hProcess</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #800080; ">0</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;结束成功!!&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
</font><font style="font: 10pt Comic Sans MS; color: #008000; ">//&nbsp;&nbsp;&nbsp;&nbsp;printf(&quot;Enter&nbsp;Process&nbsp;ID&nbsp;to&nbsp;terminate&nbsp;that&nbsp;process:&quot;);<br>
//&nbsp;&nbsp;&nbsp;&nbsp;scanf(&quot;%d&quot;,&processID);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pritnf(&quot;******开始列举Module****\n&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while()//<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pritnf(&quot;******开始列举Thread****\n&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while()//<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;TerminateProcess(hProcess2,0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000080; ">}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">CloseHandle</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">hSnapShot</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">printf</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;****************进程列举结束****************\n&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">delete&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">processInfo</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</font><font style="font: 10pt Comic Sans MS; color: #008000; ">//////////////////<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">char&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">chPath</font><font style="font: 10pt Fixedsys; color: #000080; ">[</font><font style="font: 10pt Fixedsys; color: #800080; ">301</font><font style="font: 10pt Fixedsys; color: #000080; ">];<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">char&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">path</font><font style="font: 10pt Fixedsys; color: #000080; ">[</font><font style="font: 10pt Fixedsys; color: #800080; ">200</font><font style="font: 10pt Fixedsys; color: #000080; ">]=&nbsp;</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;\\XsMenu.exe&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;::</font><font style="font: 10pt Fixedsys; color: #000000; ">GetCurrentDirectory</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #800080; ">300</font><font style="font: 10pt Fixedsys; color: #000080; ">,(</font><font style="font: 10pt Fixedsys; color: #000000; ">LPTSTR</font><font style="font: 10pt Fixedsys; color: #000080; ">)</font><font style="font: 10pt Fixedsys; color: #000000; ">chPath</font><font style="font: 10pt Fixedsys; color: #000080; ">);</font><font style="font: 10pt Comic Sans MS; color: #008000; ">//得到当前目录<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">strcat</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">chPath</font><font style="font: 10pt Fixedsys; color: #000080; ">,</font><font style="font: 10pt Fixedsys; color: #000000; ">path</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">STARTUPINFO&nbsp;si</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">PROCESS_INFORMATION&nbsp;pi</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">ZeroMemory</font><font style="font: 10pt Fixedsys; color: #000080; ">(&nbsp;&</font><font style="font: 10pt Fixedsys; color: #000000; ">pi</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">sizeof</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">pi</font><font style="font: 10pt Fixedsys; color: #000080; ">)&nbsp;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">ZeroMemory</font><font style="font: 10pt Fixedsys; color: #000080; ">(&nbsp;&</font><font style="font: 10pt Fixedsys; color: #000000; ">si</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">sizeof</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">si</font><font style="font: 10pt Fixedsys; color: #000080; ">)&nbsp;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">si</font><font style="font: 10pt Fixedsys; color: #000080; ">.</font><font style="font: 10pt Fixedsys; color: #000000; ">cb&nbsp;</font><font style="font: 10pt Fixedsys; color: #000080; ">=&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">sizeof</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">si</font><font style="font: 10pt Fixedsys; color: #000080; ">);<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">if</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">CreateProcess</font><font style="font: 10pt Fixedsys; color: #000080; ">(</font><font style="font: 10pt Fixedsys; color: #000000; ">chPath</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #808080; ">&quot;&quot;</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">NULL</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">NULL</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">FALSE</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #800080; ">0</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">NULL</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;</font><font style="font: 10pt Fixedsys; color: #000000; ">NULL</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;&</font><font style="font: 10pt Fixedsys; color: #000000; ">si</font><font style="font: 10pt Fixedsys; color: #000080; ">,&nbsp;&</font><font style="font: 10pt Fixedsys; color: #000000; ">pi</font><font style="font: 10pt Fixedsys; color: #000080; ">))<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">else&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #000080; ">{<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
</font><font style="font: 10pt Comic Sans MS; color: #008000; ">///////////////////&nbsp;&nbsp;&nbsp;&nbsp;<br>
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font style="font: 10pt Fixedsys; color: #0000FF; ">return&nbsp;</font><font style="font: 10pt Fixedsys; color: #800080; ">0</font><font style="font: 10pt Fixedsys; color: #000080; ">;<br>
}&nbsp;<br>
</font></code><img src ="http://www.cppblog.com/fdsajhg/aggbug/124498.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fdsajhg/" target="_blank">傅先生</a> 2010-08-24 06:57 <a href="http://www.cppblog.com/fdsajhg/archive/2010/08/24/124498.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>