<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>起点博客 &#187; vc2005</title>
	<atom:link href="http://xinzero.com/tag/vc2005/feed" rel="self" type="application/rss+xml" />
	<link>http://xinzero.com</link>
	<description>起于学习，点与应用，一切只为更高效</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:29:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Source insight代码对齐</title>
		<link>http://xinzero.com/source-insight-code-alignment.html</link>
		<comments>http://xinzero.com/source-insight-code-alignment.html#comments</comments>
		<pubDate>Tue, 28 Jun 2011 08:53:00 +0000</pubDate>
		<dc:creator>will</dc:creator>
				<category><![CDATA[软件应用]]></category>
		<category><![CDATA[CCS3.3]]></category>
		<category><![CDATA[keil]]></category>
		<category><![CDATA[source insight]]></category>
		<category><![CDATA[UltraEdit]]></category>
		<category><![CDATA[vc2005]]></category>

		<guid isPermaLink="false">http://xinzero.com/?p=423</guid>
		<description><![CDATA[


由于source insight默认采用Verdana字体，这种字体不是等宽的。如果使用这种字体本身就很难对齐（无论是使用空格或Tab键）。
改变source insight的字体，推荐使用Courier New字体，9号大小。方法Options-&#62;Document Options中更改，设置如下图所示。

对于自动对齐（Auto Indenting），点击上图中的Click Here，设置成如下图所示，比较符合Microsoft风格的代码对齐方式。

完成以上设置还不够，在代码中的注释或一些其它的文本仍然会使用Verdana字体，需要Options-&#62;Style Properties中各种代码风格的设置。方法是选择Style Name中的每一项，在Font Name项设置成=。如下图所示。

或者省事点，导入Style Properties文件，GLOBAL_xinzero.CF3文件。
到这一步编写代码的对齐已经没有问题了。为了好看，还需要更改source insight的context（关联窗口）窗口内的字体。方法，在context窗口内右键-&#62;选择Font…，选择Courier New字体。
经测试以上修改过后，在CCS3.3，Keil uVision，VS2005下，代码都是对齐的。UltraEdit默认的制表位为2个字符，更改为4个字符后，也是对齐的。
相关文章TI CCS3.3 out文件转bin文件说明Source insight建立工程-source insight使用Ultraedit 17 注册码破解无忧_附中文版下载地址source insight的切换标签栏工具（switch Tabbar）bin文件怎么打开]]></description>
			<content:encoded><![CDATA[<p>由于source insight默认采用Verdana字体，这种字体不是等宽的。如果使用这种字体本身就很难对齐（无论是使用空格或Tab键）。</p>
<p>改变source insight的字体，推荐使用Courier New字体，9号大小。方法<strong>Options-&gt;Document Options</strong>中更改，设置如下图所示。</p>
<p><a href="http://xinzero.com/wordpress/wp-content/uploads/2011/06/sourceinsight_DocumentOptions.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="source insight_Document Options副本" src="http://xinzero.com/wordpress/wp-content/uploads/2011/06/sourceinsight_DocumentOptions_thumb.png" border="0" alt="source insight_Document Options副本" width="532" height="395" /></a></p>
<p>对于自动对齐（Auto Indenting），点击上图中的Click Here，设置成如下图所示，比较符合Microsoft风格的代码对齐方式。</p>
<p><a href="http://xinzero.com/wordpress/wp-content/uploads/2011/06/sourceinsight_AutoIndenting.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="source insight_Auto Indenting副本" src="http://xinzero.com/wordpress/wp-content/uploads/2011/06/sourceinsight_AutoIndenting_thumb.png" border="0" alt="source insight_Auto Indenting副本" width="418" height="136" /></a></p>
<p>完成以上设置还不够，在代码中的注释或一些其它的文本仍然会使用Verdana字体，需要<strong>Options-&gt;Style Properties</strong>中各种代码风格的设置。方法是选择Style Name中的每一项，在Font Name项设置成=。如下图所示。</p>
<p><a href="http://xinzero.com/wordpress/wp-content/uploads/2011/06/sourceinsight_StyleProperties.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="source insight_Style Properties副本" src="http://xinzero.com/wordpress/wp-content/uploads/2011/06/sourceinsight_StyleProperties_thumb.png" border="0" alt="source insight_Style Properties副本" width="586" height="458" /></a></p>
<p>或者省事点，导入Style Properties文件，<a href="http://dl.dbank.com/c03506re92" target="_blank">GLOBAL_xinzero.CF3文件</a>。</p>
<p>到这一步编写代码的对齐已经没有问题了。为了好看，还需要更改source insight的context（关联窗口）窗口内的字体。方法，在<strong>context</strong><strong>窗口内右键-&gt;</strong><strong>选择Font…</strong>，选择Courier New字体。</p>
<p>经测试以上修改过后，在CCS3.3，Keil uVision，VS2005下，代码都是对齐的。UltraEdit默认的制表位为2个字符，更改为4个字符后，也是对齐的。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://xinzero.com/out-to-bin-direction-for-use.html" title="TI CCS3.3 out文件转bin文件说明">TI CCS3.3 out文件转bin文件说明</a></li><li><a href="http://xinzero.com/source-insight-create-project.html" title="Source insight建立工程-source insight使用">Source insight建立工程-source insight使用</a></li><li><a href="http://xinzero.com/ultraedit-17-sn-code-cracked-chs-download.html" title="Ultraedit 17 注册码破解无忧_附中文版下载地址">Ultraedit 17 注册码破解无忧_附中文版下载地址</a></li><li><a href="http://xinzero.com/source-insight-file-switch-tabbar.html" title="source insight的切换标签栏工具（switch Tabbar）">source insight的切换标签栏工具（switch Tabbar）</a></li><li><a href="http://xinzero.com/how-to-open-bin-files.html" title="bin文件怎么打开">bin文件怎么打开</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://xinzero.com/source-insight-code-alignment.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>win7下使用VS2005</title>
		<link>http://xinzero.com/vs2005-on-win7.html</link>
		<comments>http://xinzero.com/vs2005-on-win7.html#comments</comments>
		<pubDate>Sat, 22 May 2010 02:46:34 +0000</pubDate>
		<dc:creator>will</dc:creator>
				<category><![CDATA[软件应用]]></category>
		<category><![CDATA[vc2005]]></category>
		<category><![CDATA[Win7]]></category>

		<guid isPermaLink="false">http://xinzero.com/?p=301</guid>
		<description><![CDATA[前段时间将本本的系统升级到Win7，升级之后第一个做的居然是玩游戏，发现了Win7下《魔兽争霸》《极品飞车》等游戏不能全屏，修改注册表解决Win7游戏全屏。今天需要编译一个程序，需要安装VS2005。和往常一样先安装虚拟光驱daemon tools，但是由于daemon tools的版本太早不支持Win7，导致重启之后进入不了系统，没办法选择了Win7系统自带的系统还原，还原到一个较早的还原点。下载新版的daemon tools可以支持Win7，顺利安装完了VS2005，但在开始菜单中都找不到VS2005的启动程序，在运行中运行“devenv”也不能启动，看到是VS2005与Win7存在兼容性问题，google之，需要安装VS2005补丁VS80sp1-KB926604-X86-CHS.exe，以前支持Vista的补丁，对于Win7同样有效。
PS：安装速度巨慢，慢慢等等吧。有兴趣的同学可以看看这里。
相关文章Source insight代码对齐最新小马Win7激活工具Oem7F7_sp1版适用东芝L525vista升级到Win7编程读取注册表获取串口信息（支持Vista）VC2005运行库-解决方案]]></description>
			<content:encoded><![CDATA[<p>前段时间将本本的<a href="http://xinzero.com/toshiba-l525-update-vista-to-win7.html" target="_blank">系统升级到Win7</a>，升级之后第一个做的居然是玩游戏，发现了Win7下《魔兽争霸》《极品飞车》等游戏不能全屏，修改注册表<a href="http://xinzero.com/play-games-fullscreen-in-win7.html" target="_blank">解决Win7游戏全屏</a>。今天需要编译一个程序，需要安装VS2005。和往常一样先安装虚拟光驱daemon tools，但是由于daemon tools的版本太早不支持Win7，导致重启之后进入不了系统，没办法选择了Win7系统自带的系统还原，还原到一个较早的还原点。下载新版的daemon tools可以支持Win7，顺利安装完了VS2005，但在开始菜单中都找不到VS2005的启动程序，在运行中运行“devenv”也不能启动，看到是VS2005与Win7存在兼容性问题，google之，需要安装VS2005补丁<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bb4a75ab-e2d4-4c96-b39d-37baf6b5b1dc&amp;DisplayLang=zh-cn" target="_blank">VS80sp1-KB926604-X86-CHS.exe</a>，以前支持Vista的补丁，对于Win7同样有效。</p>
<p>PS：安装速度巨慢，慢慢等等吧。有兴趣的同学可以看看<a href="http://msdn.microsoft.com/en-us/vstudio/aa948853.aspx" target="_blank">这里</a>。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://xinzero.com/source-insight-code-alignment.html" title="Source insight代码对齐">Source insight代码对齐</a></li><li><a href="http://xinzero.com/latest-little-ma-win7-active-tools.html" title="最新小马Win7激活工具Oem7F7_sp1版适用">最新小马Win7激活工具Oem7F7_sp1版适用</a></li><li><a href="http://xinzero.com/toshiba-l525-update-vista-to-win7.html" title="东芝L525vista升级到Win7">东芝L525vista升级到Win7</a></li><li><a href="http://xinzero.com/registry-serialcomm.html" title="编程读取注册表获取串口信息（支持Vista）">编程读取注册表获取串口信息（支持Vista）</a></li><li><a href="http://xinzero.com/vc2005-redistribute-x86.html" title="VC2005运行库-解决方案">VC2005运行库-解决方案</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://xinzero.com/vs2005-on-win7.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>编程读取注册表获取串口信息（支持Vista）</title>
		<link>http://xinzero.com/registry-serialcomm.html</link>
		<comments>http://xinzero.com/registry-serialcomm.html#comments</comments>
		<pubDate>Wed, 10 Mar 2010 15:21:19 +0000</pubDate>
		<dc:creator>will</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[vc2005]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[串口通信]]></category>

		<guid isPermaLink="false">http://xinzero.com/?p=16</guid>
		<description><![CDATA[在编写串口通信程序时，经常需要列举计算机上目前可用的串口。最简单的方法是通过CreateFile串口号1~256（XP系统系统下最大支持的串口号为256），查看返回值，如果返回非INVALID_HANDLE_VALUE就证明此串口号存在。此方法简单实用，因为在只有一个串口的情况也需要遍历256个串口，需CreateFile256次，效率较低，而且不能显示目前正在使用的串口号。
下面介绍通过读取注册表获取串口号与串口个数的方法。
#define MAXCOMNO 256  //最大COM号256
typedef struct{
 char name[8];
 short no;
}SCOM;

/////用读注册表的方式查看系统的串口设备
void GetAvailableCom(SCOM *port,int &#38;cnt)
{
 HKEY  hKey; 
 LONG  ret; 
 OSVERSIONINFO    osvi; 
 BOOL  bOsVersionInfoEx; 
 CString  keyinfo;
 unsigned char comm_name[40];
 char ValueName[40];
 char szNO[3];
 int  i=0,j=0;
 cnt=0;
 DWORD  sType,Reserved,cbData,cbValueName;
 
 ZeroMemory(&#38;osvi,  sizeof(OSVERSIONINFO)); 
 osvi.dwOSVersionInfoSize  =  sizeof(OSVERSIONINFO); 
 
 keyinfo.Format(_T("HARDWARE\\DEVICEMAP\\SERIALCOMM"));
 //CString  keyinfo=_T("HARDWARE\\DEVICEMAP\\SERIALCOMM");

 i=0;  sType=REG_SZ;Reserved=0; 
 bOsVersionInfoEx  = GetVersionEx(&#38;osvi); 

 ret=RegOpenKeyEx(HKEY_LOCAL_MACHINE,keyinfo,0,KEY_ALL_ACCESS,&#38;hKey); 
 if  (ret==ERROR_SUCCESS)
 {
  if  (osvi.dwPlatformId  ==  VER_PLATFORM_WIN32_WINDOWS)    //WIN32,not used
  { 
   for(i=1;i&#60;=MAXCOMNO;i++) 
   {
    memset(comm_name, 0, 40);
    sprintf((char*)comm_name,"COM%d",i);
    ret=RegEnumValue(hKey, i, ValueName, &#38;cbValueName, NULL, &#38;sType, comm_name, &#38;cbData);
    if(ret==ERROR_SUCCESS)
    {
     i++;
    }

   } 
  } 
  else  if  (osvi.dwPlatformId  ==  VER_PLATFORM_WIN32_NT) //WINNT XP 2000
  { 
   do   
   { 
    cbData=40;cbValueName=40; 
    memset(comm_name,0,40);   
    memset(ValueName,0,40);
    memset(szNO,     0, 3);
    ret=RegEnumValue(hKey, i, ValueName, &#38;cbValueName, NULL, &#38;sType, comm_name, [...]]]></description>
			<content:encoded><![CDATA[<p>在编写<a title="调试串口通信程序" href="http://xinzero.com/serialport-communication-debug.html" target="_blank">串口通信程序</a>时，经常需要列举计算机上目前可用的串口。最简单的方法是通过CreateFile串口号1~256（XP系统系统下最大支持的串口号为256），查看返回值，如果返回非INVALID_HANDLE_VALUE就证明此串口号存在。此方法简单实用，因为在只有一个串口的情况也需要遍历256个串口，需CreateFile256次，效率较低，而且不能显示目前正在使用的串口号。</p>
<p>下面介绍通过读取注册表获取串口号与串口个数的方法。</p>
<pre name="code" class="cpp">#define MAXCOMNO 256  //最大COM号256
typedef struct{
 char name[8];
 short no;
}SCOM;

/////用读注册表的方式查看系统的串口设备
void GetAvailableCom(SCOM *port,int &amp;cnt)
{
 HKEY  hKey; 
 LONG  ret; 
 OSVERSIONINFO    osvi; 
 BOOL  bOsVersionInfoEx; 
 CString  keyinfo;
 unsigned char comm_name[40];
 char ValueName[40];
 char szNO[3];
 int  i=0,j=0;
 cnt=0;
 DWORD  sType,Reserved,cbData,cbValueName;
 
 ZeroMemory(&amp;osvi,  sizeof(OSVERSIONINFO)); 
 osvi.dwOSVersionInfoSize  =  sizeof(OSVERSIONINFO); 
 
 keyinfo.Format(_T("HARDWARE\\DEVICEMAP\\SERIALCOMM"));
 //CString  keyinfo=_T("HARDWARE\\DEVICEMAP\\SERIALCOMM");

 i=0;  sType=REG_SZ;Reserved=0; 
 bOsVersionInfoEx  = GetVersionEx(&amp;osvi); 

 ret=RegOpenKeyEx(HKEY_LOCAL_MACHINE,keyinfo,0,KEY_ALL_ACCESS,&amp;hKey); 
 if  (ret==ERROR_SUCCESS)
 {
  if  (osvi.dwPlatformId  ==  VER_PLATFORM_WIN32_WINDOWS)    //WIN32,not used
  { 
   for(i=1;i&lt;=MAXCOMNO;i++) 
   {
    memset(comm_name, 0, 40);
    sprintf((char*)comm_name,"COM%d",i);
    ret=RegEnumValue(hKey, i, ValueName, &amp;cbValueName, NULL, &amp;sType, comm_name, &amp;cbData);
    if(ret==ERROR_SUCCESS)
    {
     i++;
    }

   } 
  } 
  else  if  (osvi.dwPlatformId  ==  VER_PLATFORM_WIN32_NT) //WINNT XP 2000
  { 
   do   
   { 
    cbData=40;cbValueName=40; 
    memset(comm_name,0,40);   
    memset(ValueName,0,40);
    memset(szNO,     0, 3);
    ret=RegEnumValue(hKey, i, ValueName, &amp;cbValueName, NULL, &amp;sType, comm_name, &amp;cbData); 
    if  (ret==ERROR_SUCCESS) 
    { 
     for(j=0;j&lt;cbData;j++)
     {
      port-&gt;name[j]=comm_name[j];
      if(j&gt;2 &amp;&amp; j&lt;6)
      {
       szNO[j-3] = comm_name[j];
      }
     }
     port-&gt;no = atoi(szNO);
     port++;
     cnt++;
     i++; 
    } 
   }while(ret==ERROR_SUCCESS); 
  } 
 }
 RegCloseKey(hKey);
}</pre>
<p>port包含串口名称与编号，由于注册表中的串口名称排列并非安装串口号顺序排列而是随即排列的，便于界面中顺序列出串口号，故分别保存便于判断。cnt返回当前计算机中包含的串口数量。</p>
<p><span style="color: #ff0000;"><strong>注：由于在串口号大于8之后，不能直接用COM10来CreateFile，而要用<a>\\\\.\\COM10</a>的形式，而在COM8一下采用<a>\\\\.\\COM1</a>来CreateFile也是可以的。<br />
在Vista下用此程序来读取串口号失败，其实并没有失败而是在Vista下访问注册表需要管理员权限。解决办法单击你的程序，右键属性，选择“兼容性”选项卡，勾选最下面的“请以管理员身份运行改程序”。</strong></span></pre>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://xinzero.com/change-rs232-com-port.html" title="Windows下如何更改串口号">Windows下如何更改串口号</a></li><li><a href="http://xinzero.com/serialport-communication-debug.html" title="调试串口通信程序">调试串口通信程序</a></li><li><a href="http://xinzero.com/convert-usb-to-rs232-uart-driver-download.html" title="USB转串口驱动打包下载">USB转串口驱动打包下载</a></li><li><a href="http://xinzero.com/windows-virtual-serial-port-tool-vspd.html" title="串口调试助手_虚拟串口">串口调试助手_虚拟串口</a></li><li><a href="http://xinzero.com/test-rs232-communication-error-code-rate.html" title="串口测试通信软件">串口测试通信软件</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://xinzero.com/registry-serialcomm.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VC2005运行库-解决方案</title>
		<link>http://xinzero.com/vc2005-redistribute-x86.html</link>
		<comments>http://xinzero.com/vc2005-redistribute-x86.html#comments</comments>
		<pubDate>Sun, 07 Sep 2008 11:41:27 +0000</pubDate>
		<dc:creator>will</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[vc2005]]></category>

		<guid isPermaLink="false">http://xinzero.com/vc2005-redistribute-x86.html</guid>
		<description><![CDATA[VC2005运行库是VC2005编译出来的程序运行所依赖的库（不包括.NET支持），采用manifest方式来指定dll文件。如果将程序.exe文件直接拷贝到没有安装过VC2005的计算机上运行运行，往往会出现找不到msvcr80.dll、mfc80.dll文件等错误。
解决方案：
解决方式一、在目标系统上安装2005版vcredist_x86.exe（全称Microsoft Visual C++ 2005 Redistributable Package (x86)）。微软官方下载地址：http://download.microsoft.com/download/d/3/4/d342efa6-3266-4157-a2ec-5174867be706/vcredist_x86.exe
解决方案二、直接拷贝VS8目录下的VC \ redist \ x86 \ 目录下的 Microsoft.VC80.MFC、Microsoft.VC80.CRT、Microsoft.VC80.MFCLOC几个文件夹，到exe所在的目录下，目录结构如下：
.\myapp.exe
.\myapp.dll
.\Microsoft.VC80.CRT\
.\Microsoft.VC80.MFC\
.\Microsoft.VC80.MFC\Microsoft.VC80.MFCLOC\
然后修改Microsoft.VC80.MFCLOC目录下的Microsoft.VC80.MFCLOC.manifest文件，将其中的version=&#8221;8.0.50727.42&#8243;，修改为version=&#8221;8.0.50608.0&#8243;。
为了避免保证VS8的完整性，建议先将Microsoft.VC80.MFCLOC的文件拷出来后再修改。
相关文章Source insight代码对齐win7下使用VS2005编程读取注册表获取串口信息（支持Vista）最佳黑色背景的Visual Studio 2005配置调试串口通信程序]]></description>
			<content:encoded><![CDATA[<p>VC2005运行库是VC2005编译出来的程序运行所依赖的库（不包括.NET支持），采用manifest方式来指定dll文件。如果将程序.exe文件直接拷贝到没有安装过VC2005的计算机上运行运行，往往会出现找不到msvcr80.dll、mfc80.dll文件等错误。</p>
<p>解决方案：<br />
解决方式一、在目标系统上安装2005版vcredist_x86.exe（全称Microsoft Visual C++ 2005 Redistributable Package (x86)）。微软官方下载地址：<a href="http://download.microsoft.com/download/d/3/4/d342efa6-3266-4157-a2ec-5174867be706/vcredist_x86.exe" title="http://download.microsoft.com/download/d/3/4/d342efa6-3266-4157-a2ec-5174867be706/vcredist_x86.exe">http://download.microsoft.com/download/d/3/4/d342efa6-3266-4157-a2ec-5174867be706/vcredist_x86.exe</a></p>
<p>解决方案二、直接拷贝VS8目录下的VC \ redist \ x86 \ 目录下的 Microsoft.VC80.MFC、Microsoft.VC80.CRT、Microsoft.VC80.MFCLOC几个文件夹，到exe所在的目录下，目录结构如下：<br />
.\myapp.exe<br />
.\myapp.dll<br />
.\Microsoft.VC80.CRT\<br />
.\Microsoft.VC80.MFC\<br />
.\Microsoft.VC80.MFC\Microsoft.VC80.MFCLOC\<br />
然后修改Microsoft.VC80.MFCLOC目录下的Microsoft.VC80.MFCLOC.manifest文件，将其中的version=&#8221;8.0.50727.42&#8243;，修改为version=&#8221;8.0.50608.0&#8243;。<br />
为了避免保证VS8的完整性，建议先将Microsoft.VC80.MFCLOC的文件拷出来后再修改。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://xinzero.com/source-insight-code-alignment.html" title="Source insight代码对齐">Source insight代码对齐</a></li><li><a href="http://xinzero.com/vs2005-on-win7.html" title="win7下使用VS2005">win7下使用VS2005</a></li><li><a href="http://xinzero.com/registry-serialcomm.html" title="编程读取注册表获取串口信息（支持Vista）">编程读取注册表获取串口信息（支持Vista）</a></li><li><a href="http://xinzero.com/set-black-background-for-visual-studio-2005.html" title="最佳黑色背景的Visual Studio 2005配置">最佳黑色背景的Visual Studio 2005配置</a></li><li><a href="http://xinzero.com/serialport-communication-debug.html" title="调试串口通信程序">调试串口通信程序</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://xinzero.com/vc2005-redistribute-x86.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>最佳黑色背景的Visual Studio 2005配置</title>
		<link>http://xinzero.com/set-black-background-for-visual-studio-2005.html</link>
		<comments>http://xinzero.com/set-black-background-for-visual-studio-2005.html#comments</comments>
		<pubDate>Wed, 04 Jun 2008 04:37:48 +0000</pubDate>
		<dc:creator>will</dc:creator>
				<category><![CDATA[起点记录]]></category>
		<category><![CDATA[vc2005]]></category>

		<guid isPermaLink="false">http://xinzero.com/set-black-background-for-visual-studio-2005.html</guid>
		<description><![CDATA[在博客园看到最佳黑色背景的Visual Studio 2008配置-尤其适合开发人员使用，感觉这个样子还蛮酷的，但是作者提供的设置文件是Visual Studio 2008的，而我使用的Visual Studio 2005不知道能否兼容，为了避免不必要的麻烦，我没有使用配置文件，而是自己修改配置，其实也蛮简单的。在菜单的工具-&#62;选项中设置。如图

配置后的效果如下

相关文章Source insight代码对齐win7下使用VS2005编程读取注册表获取串口信息（支持Vista）VC2005运行库-解决方案调试串口通信程序]]></description>
			<content:encoded><![CDATA[<p>在<a target="_blank" href="http://www.cnblogs.com" title="博客园">博客园</a>看到<a target="_blank" href="http://www.cnblogs.com/entlibforum/archive/2008/05/28/1209532.html">最佳黑色背景的Visual Studio 2008配置-尤其适合开发人员使用</a>，感觉这个样子还蛮酷的，但是作者提供的设置文件是Visual Studio 2008的，而我使用的Visual Studio 2005不知道能否兼容，为了避免不必要的麻烦，我没有使用配置文件，而是自己修改配置，其实也蛮简单的。在菜单的<strong>工具-&gt;选项</strong>中设置。如图<br />
<a href="http://xinzero.com/wordpress/wp-content/uploads/2008/06/vc2005-bg-setting.png"><img border="0" width="648" src="http://xinzero.com/wordpress/wp-content/uploads/2008/06/vc2005-bg-setting-thumb.png" alt="vc2005_bg_setting" height="379" style="border-width: 0px" /></a></p>
<p>配置后的效果如下<br />
<a href="http://xinzero.com/wordpress/wp-content/uploads/2008/06/vc2005-background.png"><img border="0" width="648" src="http://xinzero.com/wordpress/wp-content/uploads/2008/06/vc2005-background-thumb.png" alt="vc2005_background" height="263" style="border-width: 0px" /></a></p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://xinzero.com/source-insight-code-alignment.html" title="Source insight代码对齐">Source insight代码对齐</a></li><li><a href="http://xinzero.com/vs2005-on-win7.html" title="win7下使用VS2005">win7下使用VS2005</a></li><li><a href="http://xinzero.com/registry-serialcomm.html" title="编程读取注册表获取串口信息（支持Vista）">编程读取注册表获取串口信息（支持Vista）</a></li><li><a href="http://xinzero.com/vc2005-redistribute-x86.html" title="VC2005运行库-解决方案">VC2005运行库-解决方案</a></li><li><a href="http://xinzero.com/serialport-communication-debug.html" title="调试串口通信程序">调试串口通信程序</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://xinzero.com/set-black-background-for-visual-studio-2005.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>调试串口通信程序</title>
		<link>http://xinzero.com/serialport-communication-debug.html</link>
		<comments>http://xinzero.com/serialport-communication-debug.html#comments</comments>
		<pubDate>Tue, 27 May 2008 12:05:03 +0000</pubDate>
		<dc:creator>will</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[vc2005]]></category>
		<category><![CDATA[串口通信]]></category>
		<category><![CDATA[调试串口]]></category>

		<guid isPermaLink="false">http://xinzero.com/serialport-communication-debug/</guid>
		<description><![CDATA[项目做到最后了，上位机（普通台式计算机）需要接收下位机（实验板）处理过后的数据，由于返回的数据较少，一次可能就是几个字节，传输时间没有严格要求，所以选择了串口通信。串口通信方式简单。调试起来也比较简单。下位机的串口硬件调试是PK同学负责的，我负责上位机的串口程序的调试。
刚开始的调试想法是让计算机COM1口发送数据，然后COM2接收，后来发现计算机就只带有一个串口，那就用邻近同学的计算机发送数据吧，但是这样是无法通信的，因为我的串口线是对等的。后来根据小丫头同学调试串口的经验，让一个串口COM1自发自收，这样就不用考虑对等线还是交叉线的问题了。
调试计算机串口，需要一根串口线，对等线或者交叉线均可。
1、检测串口线是否能连通；检测方法，用万用表检测串口线的1-9号线是否对应连通。
2、检测计算机串口是否能正常工作；检测方法，将串口线一端接入计算机串口，另一端2、3两线用导线连通。下载串口调试助手观察计算机串口的自发自收情况。
3、检测自己程序的正确性；
以下串口类在原始是应用于WINCE下，我稍作修改即可在windows下运行。以下程序在VC2005下编译、测试通过。PSerialPort.cpp增加了TRACE调试的代码。
//From unkown author:unkonwn modified by IndexZ@xinzero.com
//PSerialPort.h
#pragma once
typedef void (*LPDataArriveProc)(char *data,int length,DWORD userdata);
class CPSerialPort
{
public:
	CPSerialPort();
	virtual ~CPSerialPort();
	BOOL OpenPort(LPCTSTR Port,int Baudrate,
		/*int DataBits,int StopBits,int Parity,*/
		LPDataArriveProc proc=NULL,DWORD userdata=0); //打开串口
	BOOL ClosePort();		//关闭串口
	//激活与关闭持续接收
	BOOL Activate();
	BOOL Deactivate();
	BOOL IsActive();
	//接收数据线程函数
	static DWORD WINAPI ReadPortThread(LPVOID lpParameter);
	DWORD ReadPort(char *data,int length);		//读取一定长度的数据
	DWORD WritePort(char *data,int length);		//发送数据
	DWORD WriteFileToPort(LPCTSTR FileName);	//发送文件
private:
	HANDLE m_hComm; //串口设备handle
	HANDLE m_hReadThread; //读串口线程handle
	BOOL m_bReceiving; //是否持续接收
	int m_nBufferSize; //缓冲大小
	char *Buffer; //缓冲区
	LPDataArriveProc m_lpDataArriveProc;
	DWORD m_dwUserData;
	//串口设置以及超时参数
	DCB dcb;
	COMMTIMEOUTS CommTimeOuts;
};

//From unkown author:unkonwn [...]]]></description>
			<content:encoded><![CDATA[<p>项目做到最后了，<a href="http://xinzero.com/supervisory-computer-and-lower-computer.html">上位机</a>（普通台式计算机）需要接收<a href="http://xinzero.com/supervisory-computer-and-lower-computer.html">下位机</a>（实验板）处理过后的数据，由于返回的数据较少，一次可能就是几个字节，传输时间没有严格要求，所以选择了串口通信。<a href="http://xinzero.com/serialport-communication-debug.html">串口通信</a>方式简单。调试起来也比较简单。下位机的串口硬件调试是PK同学负责的，我负责上位机的串口程序的调试。</p>
<p>刚开始的调试想法是让计算机COM1口发送数据，然后COM2接收，后来发现计算机就只带有一个串口，那就用邻近同学的计算机发送数据吧，但是这样是无法通信的，因为我的<a target="_blank" href="http://gjwtech.com/scomm/scconnectmethod.htm" title="串口通信基本接线方法">串口线</a>是对等的。后来根据小丫头同学调试串口的经验，让一个串口COM1自发自收，这样就不用考虑对等线还是交叉线的问题了。</p>
<p>调试计算机串口，需要一根串口线，对等线或者交叉线均可。<br />
1、检测串口线是否能连通；检测方法，用万用表检测串口线的1-9号线是否对应连通。<br />
2、检测计算机串口是否能正常工作；检测方法，将串口线一端接入计算机串口，另一端2、3两线用导线连通。下载<a target="_blank" href="http://down1.tech.sina.com.cn/download/downContent/2004-03-16/2151.shtml" title="串口调试助手(SComAssistant)_调试工具_编程开发_下载">串口调试助手</a>观察计算机串口的自发自收情况。<br />
3、检测自己程序的正确性；</p>
<p>以下串口类在原始是应用于WINCE下，我稍作修改即可在windows下运行。以下程序在VC2005下编译、测试通过。PSerialPort.cpp增加了<a href="http://xinzero.com/vc2005-debug-using-trace.html">TRACE调试</a>的代码。</p>
<pre name="code" class="cpp">//From unkown author:unkonwn modified by IndexZ@xinzero.com
//PSerialPort.h
#pragma once
typedef void (*LPDataArriveProc)(char *data,int length,DWORD userdata);
class CPSerialPort
{
public:
	CPSerialPort();
	virtual ~CPSerialPort();
	BOOL OpenPort(LPCTSTR Port,int Baudrate,
		/*int DataBits,int StopBits,int Parity,*/
		LPDataArriveProc proc=NULL,DWORD userdata=0); //打开串口
	BOOL ClosePort();		//关闭串口
	//激活与关闭持续接收
	BOOL Activate();
	BOOL Deactivate();
	BOOL IsActive();
	//接收数据线程函数
	static DWORD WINAPI ReadPortThread(LPVOID lpParameter);
	DWORD ReadPort(char *data,int length);		//读取一定长度的数据
	DWORD WritePort(char *data,int length);		//发送数据
	DWORD WriteFileToPort(LPCTSTR FileName);	//发送文件
private:
	HANDLE m_hComm; //串口设备handle
	HANDLE m_hReadThread; //读串口线程handle
	BOOL m_bReceiving; //是否持续接收
	int m_nBufferSize; //缓冲大小
	char *Buffer; //缓冲区
	LPDataArriveProc m_lpDataArriveProc;
	DWORD m_dwUserData;
	//串口设置以及超时参数
	DCB dcb;
	COMMTIMEOUTS CommTimeOuts;
};</pre>
<pre name="code" class="cpp:collapse">
//From unkown author:unkonwn modified by IndexZ@xinzero.com
//PSerialPort.cpp
#include "StdAfx.h"
#include "PSerialPort.h" 

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
////////////////////////////////////////////////////////////////////// 

CPSerialPort::CPSerialPort()
{
	m_hComm = INVALID_HANDLE_VALUE;
	m_hReadThread = NULL;
	m_bReceiving = FALSE;
	m_nBufferSize = 256; //缓冲大小
} 

CPSerialPort::~CPSerialPort()
{
	ClosePort();
} 

DWORD WINAPI CPSerialPort::ReadPortThread(LPVOID lpParameter)
{
	CPSerialPort* m_pSerial;
	m_pSerial=(CPSerialPort*)lpParameter;
	BOOL fReadState;
	DWORD dwLength;
	char* buf=new char[m_pSerial-&gt;m_nBufferSize];
	while((m_pSerial-&gt;m_hComm!=INVALID_HANDLE_VALUE)
		&amp;&amp;(m_pSerial-&gt;m_bReceiving))
	{
		fReadState=ReadFile(m_pSerial-&gt;m_hComm,
			buf,m_pSerial-&gt;m_nBufferSize,&amp;dwLength,NULL);
		if(!fReadState)
		{
			AfxMessageBox(_T("无法从串口读取数据！"));
		}
		else
		{
			if(dwLength!=0)
			{	//调试输出代码开始
				TRACE("%d\n",dwLength);
				int *pint = (int*)buf;
				for(int i=0;i&lt;(dwLength/(sizeof(int)));i++)
				{
					TRACE("%d\n",pint[i]);
				}//调试输出代码结束
				//回送数据
				if(m_pSerial-&gt;m_lpDataArriveProc!=NULL)
				{
					m_pSerial-&gt;m_lpDataArriveProc(buf,
							dwLength,m_pSerial-&gt;m_dwUserData);
				}
			}
		}
		Sleep(100);		//休眠cpu
	}
	delete[] buf;
	return 0;
} 

BOOL CPSerialPort::OpenPort(LPCTSTR Port,int BaudRate,
			/*int DataBits,int StopBits,int Parity,*/
			LPDataArriveProc proc,DWORD userdata)
{
	m_lpDataArriveProc = proc;
	m_dwUserData = userdata; 

	if(m_hComm==INVALID_HANDLE_VALUE)
	{
		m_hComm=CreateFile(Port,GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,0);
		if(m_hComm==INVALID_HANDLE_VALUE )
		{
			AfxMessageBox(_T("无法打开端口！请检查是否已被占用。"));
			return FALSE;
		}
		GetCommState(m_hComm,&amp;dcb);
		dcb.BaudRate=BaudRate;
		//dcb.ByteSize=DataBits;
		//dcb.Parity=Parity;
		//dcb.StopBits=StopBits;
		dcb.fParity=FALSE;
		dcb.fBinary=TRUE;
		dcb.fDtrControl=0;
		dcb.fRtsControl=0;
		dcb.fOutX=dcb.fInX=dcb.fTXContinueOnXoff=0; 

		//设置状态参数
		SetCommMask(m_hComm,EV_RXCHAR);
		SetupComm(m_hComm,16384,16384);
		if(!SetCommState(m_hComm,&amp;dcb))
		{
			AfxMessageBox(_T("无法按当前参数配置端口，请检查参数！"));
			PurgeComm(m_hComm,PURGE_TXCLEAR|PURGE_RXCLEAR);
			ClosePort();
			return FALSE;
		} 

		//设置超时参数
		GetCommTimeouts(m_hComm,&amp;CommTimeOuts);
		CommTimeOuts.ReadIntervalTimeout=100;
		CommTimeOuts.ReadTotalTimeoutMultiplier=1;
		CommTimeOuts.ReadTotalTimeoutConstant=100;
		CommTimeOuts.WriteTotalTimeoutMultiplier=0;
		CommTimeOuts.WriteTotalTimeoutConstant=0;
		if(!SetCommTimeouts(m_hComm,&amp;CommTimeOuts))
		{
			AfxMessageBox(_T("无法设置超时参数！"));
			PurgeComm(m_hComm,PURGE_TXCLEAR|PURGE_RXCLEAR);
			ClosePort();
			return FALSE;
		} 

		PurgeComm(m_hComm,PURGE_TXCLEAR|PURGE_RXCLEAR);
		return TRUE;
	} 

	return FALSE;
} 

BOOL CPSerialPort::ClosePort()
{
	Deactivate();
	if(m_hComm!=INVALID_HANDLE_VALUE)
	{
		SetCommMask(m_hComm,0);
		PurgeComm(m_hComm,PURGE_TXCLEAR|PURGE_RXCLEAR);
		CloseHandle(m_hComm);
		m_hComm=INVALID_HANDLE_VALUE;
		return TRUE;
	} 

	return TRUE;
} 

BOOL CPSerialPort::Activate()
{
	if(m_hComm==INVALID_HANDLE_VALUE)
	{
		return FALSE;
	} 

	if(!m_bReceiving)
	{
		//开始接收线程
		PurgeComm(m_hComm,PURGE_TXCLEAR|PURGE_RXCLEAR);
		m_bReceiving=TRUE;
		m_hReadThread=CreateThread(NULL,0,ReadPortThread,this,0,NULL);
	}
	if(m_hReadThread!=NULL)
	{
		return TRUE;
	}
	else
	{
		m_bReceiving=FALSE;
		return FALSE;
	} 

	return FALSE;
} 

BOOL CPSerialPort::Deactivate()
{
	if(m_hComm==INVALID_HANDLE_VALUE)
	{
		return FALSE;
	} 

	//停止接收线程
	if(m_bReceiving)
	{
		m_bReceiving=FALSE;
		WaitForSingleObject(m_hReadThread,500);
		CloseHandle(m_hReadThread);
		m_hReadThread=NULL;
		return TRUE;
	} 

	return FALSE;
} 

BOOL CPSerialPort::IsActive()
{
	return m_bReceiving;
} 

DWORD CPSerialPort::WritePort(char *data,int length)
{
	if(m_hComm == INVALID_HANDLE_VALUE)
	{
		return 0;
	} 

	BOOL bFileWriteState;
	DWORD dwBytesWritten=0; 

	bFileWriteState = WriteFile(m_hComm,data,
			length*sizeof(char),&amp;dwBytesWritten,NULL);
//	AfxMessageBox(L"正在写串口数据。。。");
	return dwBytesWritten;
} 

DWORD CPSerialPort::ReadPort(char *data,int length)
{
	BOOL bFileReadState;
	DWORD dwLength,dwByteRead;
	int TimeOutCount; 

	dwByteRead=0;
	TimeOutCount=0;
//	AfxMessageBox(L"正在读串口数据。。。");
	while(m_hComm!=INVALID_HANDLE_VALUE)
	{
		char* buf=new char[length];
		bFileReadState = ReadFile(m_hComm,data,length,&amp;dwLength,NULL);
		if(!bFileReadState)
		{
			break;
		}
		else
		{
			dwByteRead+=dwLength;
			data+=dwLength;
		}
		if(dwByteRead == (unsigned long)length)
		{
			break;
		}
		if(dwLength!=0)
		{
			TimeOutCount=0;
		}
		else
		{
			TimeOutCount++;
			Sleep(5);
		}
		if(TimeOutCount==5)
		{
			break;
		}
	}
	return dwByteRead;
} 

DWORD CPSerialPort::WriteFileToPort(LPCTSTR FileName)
{
	CFile cf; 

	BOOL fWriteState,isOpen;
	DWORD dwBytesWritten;
	DWORD dwCharToWrite; 

	dwCharToWrite=0; 

	if(m_hComm==INVALID_HANDLE_VALUE)
	{
		return 0;
	}
	isOpen = cf.Open(FileName,CFile::modeRead);
	if(!isOpen)
	{
		//AfxMessageBox(_T("无法打开Hex文件！"));
		return 0;
	}
	dwCharToWrite=(DWORD)cf.GetLength();
	cf.Seek(0,CFile::begin); 

	dwBytesWritten=0; 

	if(m_hComm!=INVALID_HANDLE_VALUE&amp;&amp;dwCharToWrite!=0)
	{
		char* buf=new char[dwCharToWrite];
		cf.Read(buf,dwCharToWrite); 

		fWriteState=WriteFile(m_hComm,buf,dwCharToWrite*sizeof(char),
					&amp;dwBytesWritten,NULL);
		if(!fWriteState)
		{
			//AfxMessageBox(_T("无法向端口写入数据！"));
		}
		delete[] buf;
	}
	cf.Close();
	return dwBytesWritten;
}</pre>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://xinzero.com/registry-serialcomm.html" title="编程读取注册表获取串口信息（支持Vista）">编程读取注册表获取串口信息（支持Vista）</a></li><li><a href="http://xinzero.com/convert-usb-to-rs232-uart-driver-download.html" title="USB转串口驱动打包下载">USB转串口驱动打包下载</a></li><li><a href="http://xinzero.com/windows-virtual-serial-port-tool-vspd.html" title="串口调试助手_虚拟串口">串口调试助手_虚拟串口</a></li><li><a href="http://xinzero.com/test-rs232-communication-error-code-rate.html" title="串口测试通信软件">串口测试通信软件</a></li><li><a href="http://xinzero.com/change-rs232-com-port.html" title="Windows下如何更改串口号">Windows下如何更改串口号</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://xinzero.com/serialport-communication-debug.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VC2005中TRACE调试</title>
		<link>http://xinzero.com/vc2005-debug-using-trace.html</link>
		<comments>http://xinzero.com/vc2005-debug-using-trace.html#comments</comments>
		<pubDate>Fri, 09 May 2008 05:47:01 +0000</pubDate>
		<dc:creator>will</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[vc2005]]></category>
		<category><![CDATA[调试]]></category>

		<guid isPermaLink="false">http://xinzero.com/vc2005-debug-using-trace/</guid>
		<description><![CDATA[在vc2005中基于对话框的程序中，一个函数处理数据数据量较大，跟踪很不方便，因为循环次数太多，而前面的循环又没有问题，VC2005中又不能像Visual DSP++中那样设置循环多少次之后的断点（或许有，但是我没有找到）。可行的办法就是打印中间结果，对话框程序中不能和控制台程序一样简单的加个printf()输出结果。需要使用vc中的宏TRACE，TRACE和printf()类似。
TRACE( &#8220;This is a TRACE statement\n&#8221; );
TRACE( &#8220;The value of x is %d\n&#8221;, x );
输出的结果在“ 输出”窗口中显示，显示输出窗口，视图-&#62;输出。下图为输出效果。

double型的temp变量全部溢出，但还是没有找到原因，需要继续努力。
相关文章Source insight代码对齐win7下使用VS2005编程读取注册表获取串口信息（支持Vista）VC2005运行库-解决方案最佳黑色背景的Visual Studio 2005配置]]></description>
			<content:encoded><![CDATA[<p>在vc2005中基于对话框的程序中，一个函数处理数据数据量较大，跟踪很不方便，因为循环次数太多，而前面的循环又没有问题，VC2005中又不能像Visual DSP++中那样设置循环多少次之后的断点（或许有，但是我没有找到）。可行的办法就是打印中间结果，对话框程序中不能和<a href="http://xinzero.com/vc2005-console-project-problem.html">控制台程序</a>一样简单的加个printf()输出结果。需要使用vc中的宏TRACE，TRACE和printf()类似。</p>
<blockquote><p>TRACE( &#8220;This is a TRACE statement\n&#8221; );<br />
TRACE( &#8220;The value of x is %d\n&#8221;, x );</p></blockquote>
<p>输出的结果在“ 输出”窗口中显示，显示输出窗口，<strong>视图-&gt;输出。</strong>下图为输出效果。<br />
<a href="http://xinzero.com/wp-content/uploads/2008/05/trace-output2.png"><strong><img border="0" width="557" src="http://xinzero.com/wp-content/uploads/2008/05/trace-output2-thumb.png" alt="trace_output2" height="327" style="border: 0px" /></strong></a><br />
<em>double型的temp变量全部溢出，但还是没有找到原因，需要继续努力。</em></p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://xinzero.com/source-insight-code-alignment.html" title="Source insight代码对齐">Source insight代码对齐</a></li><li><a href="http://xinzero.com/vs2005-on-win7.html" title="win7下使用VS2005">win7下使用VS2005</a></li><li><a href="http://xinzero.com/registry-serialcomm.html" title="编程读取注册表获取串口信息（支持Vista）">编程读取注册表获取串口信息（支持Vista）</a></li><li><a href="http://xinzero.com/vc2005-redistribute-x86.html" title="VC2005运行库-解决方案">VC2005运行库-解决方案</a></li><li><a href="http://xinzero.com/set-black-background-for-visual-studio-2005.html" title="最佳黑色背景的Visual Studio 2005配置">最佳黑色背景的Visual Studio 2005配置</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://xinzero.com/vc2005-debug-using-trace.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VC2005下基于控制台(console)程序设计的小问题</title>
		<link>http://xinzero.com/vc2005-console-project-problem.html</link>
		<comments>http://xinzero.com/vc2005-console-project-problem.html#comments</comments>
		<pubDate>Thu, 24 Apr 2008 10:26:34 +0000</pubDate>
		<dc:creator>will</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[C语言]]></category>
		<category><![CDATA[vc2005]]></category>

		<guid isPermaLink="false">http://xinzero.com/vc2005-console-project-problem/</guid>
		<description><![CDATA[由于调试的需要，前段时间将微软的开发平台升级到VS2005(VC8.0),第一感觉就是大，仅安装光盘的镜像就3G多，安装需要近4G空间。安装完成后总体来说还是可以，启动、运行速度没有想象中那么慢。在VS2005中看源程序很方便，右键菜单中的&#8221;转到定义&#8221;、&#8221;转到声明&#8221;，配合上工具栏上的&#8221;向前定位&#8221;、&#8221;向后定位&#8221;使用。也遇到了几个小问题，解决方法如下，希望对于用VC调试C语言程序的同学有一点帮助。
问题一、基于控制台的程序，运行一闪而过，没法看结果，为什么不能和VC6.0那样显示&#8221;press any key to continue&#8230;&#8221;?
此时想起好像是java中有个system(&#8221;pause&#8221;);函数可以是屏幕暂停。测试一下，果然出现了熟悉&#8221;请按任意键继续. . .&#8221;，后来查了一了c语言函数手册，才知道system()，原来是c的库函数包含于dos.h头文件中。但在vs2005的控制台程序中使用时，发现必须包含stdlib.h头文件，才能正常使用。
问题二，本次调试的程序是带有的命令行的控制台程序，调试的时候如何输入命令行呢？
以前确实没有遇到过这中情况，百度一下，解决办法如下:
在VS2005的菜单-&#62;项目-&#62;属性-&#62;配置属性-&#62;调试   命令行参数中输入运行参数,即可带参数调试了。
问题三、设置断点后，到断点程序不停止，&#8221;输出&#8221;窗口显示&#8221;未使用调试信息生成二进制文件&#8221;，为什么不能单步调试呢？
在VC6中建一个基于控制台(console)空项目，就可以对C++程序进行调试,然而在vs2005下新建项目选择 常规-&#62;空项目 那么所生成的工程就不能调试，此时工程默认情况下也不会生成调试信息。
如何才能单步调试呢？我没有找到好的解决办法。我是通过新建工程解决。新建 Win32-&#62;Win32控制台应用程序 然后选择空工程就可以了。
相关文章Source insight代码对齐source insight的切换标签栏工具（switch Tabbar）俄罗斯套娃问题的C语言解win7下使用VS2005CCS3.3关于__strasgi的bug]]></description>
			<content:encoded><![CDATA[<p>由于调试的需要，前段时间将微软的开发平台升级到VS2005(VC8.0),第一感觉就是大，仅安装光盘的镜像就3G多，安装需要近4G空间。安装完成后总体来说还是可以，启动、运行速度没有想象中那么慢。在VS2005中看源程序很方便，右键菜单中的&#8221;转到定义&#8221;、&#8221;转到声明&#8221;，配合上工具栏上的&#8221;向前定位&#8221;、&#8221;向后定位&#8221;使用。也遇到了几个小问题，解决方法如下，希望对于用VC调试C语言程序的同学有一点帮助。</p>
<p>问题一、基于控制台的程序，运行一闪而过，没法看结果，为什么不能和VC6.0那样显示&#8221;press any key to continue&#8230;&#8221;?<br />
此时想起好像是java中有个system(&#8221;pause&#8221;);函数可以是屏幕暂停。测试一下，果然出现了熟悉&#8221;请按任意键继续. . .&#8221;，后来查了一了c语言函数手册，才知道system()，原来是c的库函数包含于dos.h头文件中。但在vs2005的控制台程序中使用时，发现必须包含stdlib.h头文件，才能正常使用。</p>
<p>问题二，本次调试的程序是带有的命令行的控制台程序，调试的时候如何输入命令行呢？<br />
以前确实没有遇到过这中情况，百度一下，解决办法如下:<br />
在VS2005的菜单-&gt;项目-&gt;属性-&gt;配置属性-&gt;调试   命令行参数中输入运行参数,即可带参数调试了。</p>
<p>问题三、设置断点后，到断点程序不停止，&#8221;输出&#8221;窗口显示&#8221;未使用调试信息生成二进制文件&#8221;，为什么不能单步调试呢？<br />
在VC6中建一个基于控制台(console)空项目，就可以对C++程序进行调试,然而在vs2005下新建项目选择 常规-&gt;空项目 那么所生成的工程就不能调试，此时工程默认情况下也不会生成调试信息。<br />
如何才能单步调试呢？我没有找到好的解决办法。我是通过新建工程解决。新建 Win32-&gt;Win32控制台应用程序 然后选择空工程就可以了。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://xinzero.com/source-insight-code-alignment.html" title="Source insight代码对齐">Source insight代码对齐</a></li><li><a href="http://xinzero.com/source-insight-file-switch-tabbar.html" title="source insight的切换标签栏工具（switch Tabbar）">source insight的切换标签栏工具（switch Tabbar）</a></li><li><a href="http://xinzero.com/russian-doll-problems.html" title="俄罗斯套娃问题的C语言解">俄罗斯套娃问题的C语言解</a></li><li><a href="http://xinzero.com/vs2005-on-win7.html" title="win7下使用VS2005">win7下使用VS2005</a></li><li><a href="http://xinzero.com/ccs3-3-__strasgi-bug.html" title="CCS3.3关于__strasgi的bug">CCS3.3关于__strasgi的bug</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://xinzero.com/vc2005-console-project-problem.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>无法解析的外部符号,VC2005链接错误解决办法</title>
		<link>http://xinzero.com/vc2005-link-error-resolve.html</link>
		<comments>http://xinzero.com/vc2005-link-error-resolve.html#comments</comments>
		<pubDate>Wed, 02 Apr 2008 08:15:15 +0000</pubDate>
		<dc:creator>will</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[vc2005]]></category>

		<guid isPermaLink="false">http://xinzero.com/vc2005-link-error-resolve/</guid>
		<description><![CDATA[今天在生成一个工程的时候，编译没有问题，但是在链接的时候出了问题，出现了无法解析的外部符号，错误提示如下：
error LNK2019: 无法解析的外部符号
_imp__SetupDiGetDeviceInterfaceDetailW@24
error LNK2001: 无法解析的外部符号
&#8220;private: static struct _OVERLAPPED
CUsbCom::g_WriteOverlapped&#8221;
既然编译通过了，就说明了没有语法错误，不用在代码中死抠语法了。从错误中提示中找原因吧。
SetupDiGetDeviceInterfaceDetailW是程序中调用的一个函数，MSDN一下，应用此函数需要Setupapi.lib头文件，这个已经包含（不然编译也不能通过），再往下看发现需要Setupapi.lib或Setupapi.dll库。手动添加，项目-&#62;属性-&#62;配置属性-&#62;链接器-&#62;输入 然后在附件依赖项添加Setupapi.lib，再生成第一个无法解析的外部符号错误消失了。
g_WriteOverlapped是我定义的一个类的静态数据成员，原来是没有初始化，在类的.cpp文件中，函数体外初始化g_WriteOverlapped，再生成没有错误了。
相关文章Source insight代码对齐win7下使用VS2005编程读取注册表获取串口信息（支持Vista）VC2005运行库-解决方案最佳黑色背景的Visual Studio 2005配置]]></description>
			<content:encoded><![CDATA[<p>今天在生成一个工程的时候，编译没有问题，但是在链接的时候出了问题，出现了无法解析的外部符号，错误提示如下：</p>
<blockquote><p>error LNK2019: 无法解析的外部符号<br />
_imp__SetupDiGetDeviceInterfaceDetailW@24<br />
error LNK2001: 无法解析的外部符号<br />
&#8220;private: static struct _OVERLAPPED<br />
CUsbCom::g_WriteOverlapped&#8221;</p></blockquote>
<p>既然编译通过了，就说明了没有语法错误，不用在代码中死抠语法了。从错误中提示中找原因吧。</p>
<p>SetupDiGetDeviceInterfaceDetailW是程序中调用的一个函数，MSDN一下，应用此函数需要Setupapi.lib头文件，这个已经包含（不然编译也不能通过），再往下看发现需要Setupapi.lib或Setupapi.dll库。手动添加，项目-&gt;属性-&gt;配置属性-&gt;链接器-&gt;输入 然后在附件依赖项添加Setupapi.lib，再生成第一个无法解析的外部符号错误消失了。</p>
<p>g_WriteOverlapped是我定义的一个类的静态数据成员，原来是没有初始化，在类的.cpp文件中，函数体外初始化g_WriteOverlapped，再生成没有错误了。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://xinzero.com/source-insight-code-alignment.html" title="Source insight代码对齐">Source insight代码对齐</a></li><li><a href="http://xinzero.com/vs2005-on-win7.html" title="win7下使用VS2005">win7下使用VS2005</a></li><li><a href="http://xinzero.com/registry-serialcomm.html" title="编程读取注册表获取串口信息（支持Vista）">编程读取注册表获取串口信息（支持Vista）</a></li><li><a href="http://xinzero.com/vc2005-redistribute-x86.html" title="VC2005运行库-解决方案">VC2005运行库-解决方案</a></li><li><a href="http://xinzero.com/set-black-background-for-visual-studio-2005.html" title="最佳黑色背景的Visual Studio 2005配置">最佳黑色背景的Visual Studio 2005配置</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://xinzero.com/vc2005-link-error-resolve.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

