﻿<?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++博客-edog-随笔分类-应用程序</title><link>http://www.cppblog.com/edog/category/474.html</link><description>冰冻热狗</description><language>zh-cn</language><lastBuildDate>Wed, 21 May 2008 20:37:15 GMT</lastBuildDate><pubDate>Wed, 21 May 2008 20:37:15 GMT</pubDate><ttl>60</ttl><item><title>一个串口通讯的类</title><link>http://www.cppblog.com/edog/archive/2007/11/21/37062.html</link><dc:creator>冰冻热狗</dc:creator><author>冰冻热狗</author><pubDate>Wed, 21 Nov 2007 02:28:00 GMT</pubDate><guid>http://www.cppblog.com/edog/archive/2007/11/21/37062.html</guid><wfw:comment>http://www.cppblog.com/edog/comments/37062.html</wfw:comment><comments>http://www.cppblog.com/edog/archive/2007/11/21/37062.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/edog/comments/commentRss/37062.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/edog/services/trackbacks/37062.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: /**//*&nbsp;CommUtils.h&nbsp;*/#ifndef&nbsp;_CommUtils_H__#define&nbsp;_CommUtils_H__class&nbsp;CommUtils&nbsp;&nbsp;{public:&nbsp;&nbsp;&nbsp;&nbsp;bool&nbsp;ReadCom(unsigned&nbsp;char&nbsp;*&nbsp;Re...&nbsp;&nbsp;<a href='http://www.cppblog.com/edog/archive/2007/11/21/37062.html'>阅读全文</a><img src ="http://www.cppblog.com/edog/aggbug/37062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/edog/" target="_blank">冰冻热狗</a> 2007-11-21 10:28 <a href="http://www.cppblog.com/edog/archive/2007/11/21/37062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一些常用函数</title><link>http://www.cppblog.com/edog/archive/2007/11/21/37060.html</link><dc:creator>冰冻热狗</dc:creator><author>冰冻热狗</author><pubDate>Wed, 21 Nov 2007 02:12:00 GMT</pubDate><guid>http://www.cppblog.com/edog/archive/2007/11/21/37060.html</guid><wfw:comment>http://www.cppblog.com/edog/comments/37060.html</wfw:comment><comments>http://www.cppblog.com/edog/archive/2007/11/21/37060.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/edog/comments/commentRss/37060.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/edog/services/trackbacks/37060.html</trackback:ping><description><![CDATA[1、取当前路径<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"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;szCurPath[</span><span style="COLOR: #000000">256</span><span style="COLOR: #000000">];<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;GetModuleFileName(NULL,&nbsp;szCurPath,&nbsp;</span><span style="COLOR: #000000">256</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">strlen(szCurPath)</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;&nbsp;i</span><span style="COLOR: #000000">&gt;=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;i</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_108_179_Open_Image onclick="this.style.display='none'; Codehighlighter1_108_179_Open_Text.style.display='none'; Codehighlighter1_108_179_Closed_Image.style.display='inline'; Codehighlighter1_108_179_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_108_179_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_108_179_Closed_Text.style.display='none'; Codehighlighter1_108_179_Open_Image.style.display='inline'; Codehighlighter1_108_179_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_108_179_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_108_179_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(szCurPath[i]&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\\</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_141_176_Open_Image onclick="this.style.display='none'; Codehighlighter1_141_176_Open_Text.style.display='none'; Codehighlighter1_141_176_Closed_Image.style.display='inline'; Codehighlighter1_141_176_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_141_176_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_141_176_Closed_Text.style.display='none'; Codehighlighter1_141_176_Open_Image.style.display='inline'; Codehighlighter1_141_176_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_141_176_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_141_176_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;szCurPath[i</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">0</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></div>
<br>2、设置CListCtrl风格<br>m_List1.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);<br><br>3、INI文件操作<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: #0000ff">char</span><span style="COLOR: #000000">&nbsp;ss[</span><span style="COLOR: #000000">20</span><span style="COLOR: #000000">];<br>GetPrivateProfileString(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">COMM</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">BaudRate</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">,&nbsp;ss,&nbsp;</span><span style="COLOR: #000000">20</span><span style="COLOR: #000000">,&nbsp;szCurPath);<br>WritePrivateProfileString(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">COMM</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">BaudRate</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;ss,&nbsp;szCurPath);</span></div>
<br>4、字符串转为16进制<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: #0000ff">void</span><span style="COLOR: #000000">&nbsp;CommUtils::HexToChar(unsigned&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">hex,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;dwLength,&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">buf)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;s[</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">];<br>&nbsp;&nbsp;&nbsp;&nbsp;buf[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;i</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">dwLength;&nbsp;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sprintf(s,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%02X&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;hex[i]);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strcat(buf,&nbsp;s);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}</span></div>
<img src ="http://www.cppblog.com/edog/aggbug/37060.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/edog/" target="_blank">冰冻热狗</a> 2007-11-21 10:12 <a href="http://www.cppblog.com/edog/archive/2007/11/21/37060.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>读取硬盘物理序列号</title><link>http://www.cppblog.com/edog/archive/2005/12/01/1455.html</link><dc:creator>冰冻热狗</dc:creator><author>冰冻热狗</author><pubDate>Wed, 30 Nov 2005 18:23:00 GMT</pubDate><guid>http://www.cppblog.com/edog/archive/2005/12/01/1455.html</guid><wfw:comment>http://www.cppblog.com/edog/comments/1455.html</wfw:comment><comments>http://www.cppblog.com/edog/archive/2005/12/01/1455.html#Feedback</comments><slash:comments>23</slash:comments><wfw:commentRss>http://www.cppblog.com/edog/comments/commentRss/1455.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/edog/services/trackbacks/1455.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>WINNT</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下实现的，</SPAN><SPAN lang=EN-US>WIN98</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下不行，网上搜索了一通，高人给出</SPAN><SPAN lang=EN-US>WIN98</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下的实现代码要用到汇编，还要取得</SPAN><SPAN lang=EN-US>Ring0</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级别的控制权，狂晕～～～偶毕业后就把汇编还给老师了，还是老老实实用</SPAN><SPAN lang=EN-US>C++</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">代码吧。具体的</SPAN><SPAN lang=EN-US>C++</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和汇编源码可以在此找到：</SPAN><SPAN lang=EN-US><A href="http://www.cz88.net/2004/7-7/235257.htm">http://www.cz88.net/2004/7-7/235257.htm</A> </SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>&nbsp;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">读取硬盘物理序列号有什么用？用来对软件加密最好了，别告诉我你是用</SPAN><SPAN lang=EN-US>C</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">盘的逻辑序列号来加密的，那个冬冬可是可以用程序改的。不过听说现在连硬盘的物理序列号也可以改，不知道怎么才能改呢，高人指点一下。这个程序主要是针对有序列号的</SPAN><SPAN lang=EN-US>IDE HDD</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而言</SPAN><SPAN lang=EN-US>, </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于没有序列号或</SPAN><SPAN lang=EN-US>SCSI HDD</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">硬盘则无能为力，这是其局限性。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现原理：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; tab-stops: list 18.0pt; mso-list: l0 level1 lfo1"><SPAN lang=EN-US>1、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US>CreateFile</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以打开物理设备和串口等，使用</SPAN><SPAN lang=EN-US>CreateFile("<A href="file://.//PHYSICALDRIVE0">\\\\.\\PHYSICALDRIVE0</A>",…)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">打开硬盘，其中的</SPAN><SPAN lang=EN-US>0</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为</SPAN><SPAN lang=EN-US>0-255</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，视乎有几个硬盘了。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; tab-stops: list 18.0pt; mso-list: l0 level1 lfo1"><SPAN lang=EN-US>2、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</SPAN><SPAN lang=EN-US>DeviceIoControl</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数对打开的设备进行通信，发送指定命令，根据返回的</SPAN><SPAN lang=EN-US>PSENDCMDOUTPARAMS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">结构，得到物理序列号和模型号，把物理序列号和模型号格式化为一定的格式输出。<BR><IMG height=297 alt=DiskInfo.jpg src="http://www.cppblog.com/images/cppblog_com/edog/DiskInfo.jpg" width=461 border=0><BR><BR>顺便把各个逻辑驱动器的信息也读取一下，包括卷标，驱动器类型和逻辑序列号等。主要是用GetLogicalDriveStrings和GetVolumeInformation和GetDriveType几个API。图示是偶的机器上的结果。<BR>程序：<A href="/Files/edog/DiskInfo.zip">diskinfo.zip</A><BR></SPAN></P><img src ="http://www.cppblog.com/edog/aggbug/1455.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/edog/" target="_blank">冰冻热狗</a> 2005-12-01 02:23 <a href="http://www.cppblog.com/edog/archive/2005/12/01/1455.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>取本机IP地址和网卡号</title><link>http://www.cppblog.com/edog/archive/2005/11/30/1424.html</link><dc:creator>冰冻热狗</dc:creator><author>冰冻热狗</author><pubDate>Tue, 29 Nov 2005 17:13:00 GMT</pubDate><guid>http://www.cppblog.com/edog/archive/2005/11/30/1424.html</guid><wfw:comment>http://www.cppblog.com/edog/comments/1424.html</wfw:comment><comments>http://www.cppblog.com/edog/archive/2005/11/30/1424.html#Feedback</comments><slash:comments>15</slash:comments><wfw:commentRss>http://www.cppblog.com/edog/comments/commentRss/1424.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/edog/services/trackbacks/1424.html</trackback:ping><description><![CDATA[<SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">界面如下，主要是使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Winsock</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">的一些东东取机器名和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">IP</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">地址，取网卡就麻烦些，需要发送</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Netbios</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">命令，需要注意的是需要包含</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">winsock2.h</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">nb30.h</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">，并且要引入两个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">lib</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">：<BR><IMG height=129 alt=GetIPName.jpg src="http://www.cppblog.com/images/cppblog_com/edog/GetIPName.jpg" width=324 border=0><BR><BR>包含头和lib如下：<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"><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">#include</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">winsock2.h</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>#include&nbsp;</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">nb30.h</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>#pragma&nbsp;comment(lib,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">netapi32.lib</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>#pragma&nbsp;comment(lib,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Wsock32.lib</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)</SPAN></DIV><BR>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">具体的实现参考源程序。</SPAN></P><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><FONT color=#ff1493><STRONG>源程序下载：</STRONG></FONT><A href="/Files/edog/GetIPName.rar">http://www.cppblog.com/Files/edog/GetIPName.rar</A><BR><BR><BR>根据<A id=Comments1_CommentList__ctl1_NameLink HREF="/shootingstars/" target=_blank><FONT color=#223355>shootingstars</FONT></A> 的指点，编写了一下用 Iphlpapi 取IP地址的代码，可以取本机IP，网关IP，子网掩码，网卡名字等，需要在VC7上编译：<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"><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">#include&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">stdio.h</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>#include&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">windows.h</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>#include&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Iphlpapi.h</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>#pragma&nbsp;comment(lib,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Iphlpapi.lib</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;main()&nbsp;<BR><IMG id=Codehighlighter1_116_635_Open_Image onclick="this.style.display='none'; Codehighlighter1_116_635_Open_Text.style.display='none'; Codehighlighter1_116_635_Closed_Image.style.display='inline'; Codehighlighter1_116_635_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_116_635_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_116_635_Closed_Text.style.display='none'; Codehighlighter1_116_635_Open_Image.style.display='inline'; Codehighlighter1_116_635_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_116_635_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cppblog.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_116_635_Open_Text><SPAN style="COLOR: #000000">{&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top>IP_ADAPTER_INFO&nbsp;pAdapterInfo;&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top>ULONG&nbsp;len&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">sizeof</SPAN><SPAN style="COLOR: #000000">(pAdapterInfo);&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">(GetAdaptersInfo(</SPAN><SPAN style="COLOR: #000000">&amp;</SPAN><SPAN style="COLOR: #000000">pAdapterInfo,&nbsp;</SPAN><SPAN style="COLOR: #000000">&amp;</SPAN><SPAN style="COLOR: #000000">len)&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;ERROR_SUCCESS)&nbsp;<BR><IMG id=Codehighlighter1_245_286_Open_Image onclick="this.style.display='none'; Codehighlighter1_245_286_Open_Text.style.display='none'; Codehighlighter1_245_286_Closed_Image.style.display='inline'; Codehighlighter1_245_286_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_245_286_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_245_286_Closed_Text.style.display='none'; Codehighlighter1_245_286_Open_Image.style.display='inline'; Codehighlighter1_245_286_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_245_286_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cppblog.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_245_286_Open_Text><SPAN style="COLOR: #000000">{&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top>printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GetAdaptersInfo&nbsp;ERROR!\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG id=Codehighlighter1_295_632_Open_Image onclick="this.style.display='none'; Codehighlighter1_295_632_Open_Text.style.display='none'; Codehighlighter1_295_632_Closed_Image.style.display='inline'; Codehighlighter1_295_632_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_295_632_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_295_632_Closed_Text.style.display='none'; Codehighlighter1_295_632_Open_Image.style.display='inline'; Codehighlighter1_295_632_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_295_632_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cppblog.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_295_632_Open_Text><SPAN style="COLOR: #000000">{&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top>printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">AdapterName:&nbsp;%s\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;pAdapterInfo.AdapterName);&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top>printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Description:&nbsp;%s\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;pAdapterInfo.Description);&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top>printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">IP&nbsp;Address&nbsp;:&nbsp;%s\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;pAdapterInfo.IpAddressList.IpAddress.String);&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top>printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">IP&nbsp;Mask&nbsp;:&nbsp;%s\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;pAdapterInfo.IpAddressList.IpMask.String);&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align=top>printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Gateway&nbsp;IP&nbsp;:&nbsp;%s\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;pAdapterInfo.GatewayList.IpAddress.String);&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>输出结果如下：&nbsp;<BR><IMG id=Codehighlighter1_661_698_Open_Image onclick="this.style.display='none'; Codehighlighter1_661_698_Open_Text.style.display='none'; Codehighlighter1_661_698_Closed_Image.style.display='inline'; Codehighlighter1_661_698_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_661_698_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_661_698_Closed_Text.style.display='none'; Codehighlighter1_661_698_Open_Image.style.display='inline'; Codehighlighter1_661_698_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align=top>AdapterName:&nbsp;</SPAN><SPAN id=Codehighlighter1_661_698_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cppblog.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_661_698_Open_Text><SPAN style="COLOR: #000000">{475CB3CA</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">3478</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">415A</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">86D8</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">7E5982306F58}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>Description:&nbsp;D</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">Link&nbsp;DFE</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">530TX&nbsp;PCI&nbsp;Fast&nbsp;Ethernet&nbsp;Adapter&nbsp;(rev.C)&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>IP&nbsp;Address&nbsp;:&nbsp;</SPAN><SPAN style="COLOR: #000000">192.168</SPAN><SPAN style="COLOR: #000000">.</SPAN><SPAN style="COLOR: #000000">168.23</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>IP&nbsp;Mask&nbsp;:&nbsp;</SPAN><SPAN style="COLOR: #000000">255.255</SPAN><SPAN style="COLOR: #000000">.</SPAN><SPAN style="COLOR: #000000">255.0</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align=top>Gateway&nbsp;IP&nbsp;:&nbsp;</SPAN><SPAN style="COLOR: #000000">192.168</SPAN><SPAN style="COLOR: #000000">.</SPAN><SPAN style="COLOR: #000000">168.10</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN></DIV></SPAN></SPAN><img src ="http://www.cppblog.com/edog/aggbug/1424.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/edog/" target="_blank">冰冻热狗</a> 2005-11-30 01:13 <a href="http://www.cppblog.com/edog/archive/2005/11/30/1424.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>文件改名小程序</title><link>http://www.cppblog.com/edog/archive/2005/11/30/1423.html</link><dc:creator>冰冻热狗</dc:creator><author>冰冻热狗</author><pubDate>Tue, 29 Nov 2005 16:52:00 GMT</pubDate><guid>http://www.cppblog.com/edog/archive/2005/11/30/1423.html</guid><wfw:comment>http://www.cppblog.com/edog/comments/1423.html</wfw:comment><comments>http://www.cppblog.com/edog/archive/2005/11/30/1423.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/edog/comments/commentRss/1423.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/edog/services/trackbacks/1423.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">很久以前写的一个小程序，为了自己工作的方便。以前工作要用到一些工程代码，结构是固定的，又不能使用</SPAN><SPAN lang=EN-US>VC</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来建立工程，只好每次做一个新的程序都拿原来的程序工程改名，然后再用</SPAN><SPAN lang=EN-US>UltraEdit</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等打开每个源文件再改字符串，比较简单实用，用来改代码工程正好。<BR></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT color=#ff1493><STRONG>下载：</STRONG></FONT><A HREF="/Files/edog/ChangeName.rar">http://www.cppblog.com/Files/edog/ChangeName.rar</A><BR>&nbsp;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l0 level1 lfo1"><B><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序介绍</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">使用基本的对话框程序，界面如下，通过选择目录，把其中的文件列出，输入需要修改的名字和修改后的名字，然后按“转换”按钮即可。<BR>
<P align=center><IMG height=216 alt=ChangeName.jpg src="http://www.cppblog.com/images/cppblog_com/edog/ChangeName.jpg" width=365 border=0></P><BR>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l0 level1 lfo1"><B><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序结构</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; tab-stops: list 39.0pt; mso-list: l0 level2 lfo1"><SPAN lang=EN-US><FONT face="Times New Roman">1、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">主要使用了一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PathDialog</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的类，用来选择目录，是网上找的。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; tab-stops: list 39.0pt; mso-list: l0 level2 lfo1"><SPAN lang=EN-US><FONT face="Times New Roman">2、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选择了目录后，使用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">CListBox</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Dir</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数把文件列举出来，省略了用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">FindFile</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">去找文件的麻烦：）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; tab-stops: list 39.0pt; mso-list: l0 level2 lfo1"><SPAN lang=EN-US><FONT face="Times New Roman">3、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">转换时从</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">ListBox</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">读取每个文件，再根据源字符串和目标字符串，使用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rename</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数改名，要记住加上文件的路径。</SPAN></P><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">完成改名后重新列举文件到</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-fareast-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">ListBox</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">，一切</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-fareast-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">OVER</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">。</SPAN></SPAN><img src ="http://www.cppblog.com/edog/aggbug/1423.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/edog/" target="_blank">冰冻热狗</a> 2005-11-30 00:52 <a href="http://www.cppblog.com/edog/archive/2005/11/30/1423.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用VC++6.0编程实现汉字拼音查找</title><link>http://www.cppblog.com/edog/archive/2005/11/30/1422.html</link><dc:creator>冰冻热狗</dc:creator><author>冰冻热狗</author><pubDate>Tue, 29 Nov 2005 16:25:00 GMT</pubDate><guid>http://www.cppblog.com/edog/archive/2005/11/30/1422.html</guid><wfw:comment>http://www.cppblog.com/edog/comments/1422.html</wfw:comment><comments>http://www.cppblog.com/edog/archive/2005/11/30/1422.html#Feedback</comments><slash:comments>15</slash:comments><wfw:commentRss>http://www.cppblog.com/edog/comments/commentRss/1422.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/edog/services/trackbacks/1422.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 用VC++6.0编程实现汉字拼音查找eDog[原创]摘要&nbsp;&nbsp; 使用VC++6.0编程查找汉字的拼音关键字&nbsp;&nbsp; 汉字，拼音，资源下载：http://www.cppblog.com/Files/edog/LookPY.rar一、&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n...&nbsp;&nbsp;<a href='http://www.cppblog.com/edog/archive/2005/11/30/1422.html'>阅读全文</a><img src ="http://www.cppblog.com/edog/aggbug/1422.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/edog/" target="_blank">冰冻热狗</a> 2005-11-30 00:25 <a href="http://www.cppblog.com/edog/archive/2005/11/30/1422.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>