<?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>老魏的博客, Wiz, CyberArticle作者官方网站 &#187; Visual C++</title>
	<atom:link href="http://weishijun.com/p/category/visual-c/feed" rel="self" type="application/rss+xml" />
	<link>http://weishijun.com</link>
	<description>Wiz, CyberArticle开发手记</description>
	<lastBuildDate>Sat, 08 Jan 2011 12:16:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Visual C++的STL和CComPtr的一个问题</title>
		<link>http://weishijun.com/p/351</link>
		<comments>http://weishijun.com/p/351#comments</comments>
		<pubDate>Thu, 28 May 2009 13:52:34 +0000</pubDate>
		<dc:creator>魏 拾俊</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://weishijun.com/p/351</guid>
		<description><![CDATA[今天在编写IFilter插件的时候，发现一个STL和CComPtr问题（Visual C++ / Visual Studio 2008）：
我定义了一个数组：
std::vector&#60;CComPtr&#60;ICANode&#62; &#62; arrayNodes;
当我对这个数组排序的时候：
std::sort(arrayNodes.begin(), arrayNodes.end(), CompareNodeByID);
出现了一个断言失败，位于atlcomcli.h第149行，如下：
&#160;&#160;&#160;&#160;//The assert on operator&#38; usually indicates a bug. If this is really&#160;&#160;&#160;&#160;//what is needed, however, take the address of the p member explicitly.&#160;&#160;&#160;&#160;T** operator&#38;() throw()&#160;&#160;&#160;&#160;{&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ATLASSERT(p==NULL);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return &#38;p;&#160;&#160;&#160;&#160;}
在这个函数之前，这里有一个说明，ATL的作者认为通常来说，对于一个CComPtr对象获得地址，一般是用来给这个对象赋予一个新的值，就像QueryInterface那样。所以，在这个时候，p本身的值，应该是空。
然后经过跟踪，发现是std::sort这里在调用&#38;操作符（&#60;utility&#62;文件）：
template&#60;class _Ty&#62; inline&#160;&#160;&#160;&#160;void swap(_Ty&#38; _Left, _Ty&#38; _Right)&#160;&#160;&#160;&#160;{&#160;&#160;&#160;&#160;// exchange values stored at _Left and _Right&#160;&#160;&#160;&#160;if (&#38;_Left != &#38;_Right)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{&#160;&#160;&#160;&#160;// different, worth swapping&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;_Ty _Tmp [...]]]></description>
		<wfw:commentRss>http://weishijun.com/p/351/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ToolBar的一个奇怪现象</title>
		<link>http://weishijun.com/p/249</link>
		<comments>http://weishijun.com/p/249#comments</comments>
		<pubDate>Wed, 13 May 2009 07:15:47 +0000</pubDate>
		<dc:creator>魏 拾俊</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[程序设计]]></category>

		<guid isPermaLink="false">http://weishijun.com/p/249</guid>
		<description><![CDATA[ToolBar的一个奇怪现象
将CyberArticle Express工具栏修改成标准的Windows工具栏（使用CToolBarCtrl），结果发现一个奇怪的现象：
如果工具栏按钮包含下拉按钮BTNS_DROPDOWN，而且工具栏具有TBSTYLE_EX_DRAWDDARROWS和TBSTYLE_FLAT风格，则工具栏按钮在某些情况下，会变得很大（例如更改Theme，或者某些系统下面，锁定计算机，然后再恢复）。
经过检查，原来这是COMCTL32的一个问题：在MFC的CToolBar这个类里面，修复了这个问题，但是CToolBarCtrl没有修复这个问题。
下面是bartool.cpp里面的一段说明
//&#160; In comctl32 version 6.00 when using XP Look combined with TBSTYLE_EX_DRAWDDARROWS //&#160;style minimal sizing policy was changed to be//&#160;&#160;&#160;button.height &#62;= image.height + 13//&#160;&#160;&#160;button.width &#62;= image.width + 16//&#160;this force buttons to be bigger then usual//&#160;To override this behavior we should remove TBSTYLE_EX_DRAWDDARROWS prior to sizing operations//
在CToolBarCtrl派生类里面，增加消息处理。下面的代码，是从bartool.cpp里面找到的。

ON_MESSAGE(WM_SETTINGCHANGE, OnPreserveZeroBorderHelper)
ON_MESSAGE(WM_SETFONT, OnPreserveZeroBorderHelper)
&#160;
LRESULT CWizToolBarCtrlEx::OnPreserveZeroBorderHelper(WPARAM, LPARAM)
{
&#160;&#160;&#160;&#160;int _afxComCtlVersion = _AfxGetComCtlVersion();
&#160;&#160;&#160;&#160;//
&#160;&#160;&#160;&#160;BOOL bModify [...]]]></description>
		<wfw:commentRss>http://weishijun.com/p/249/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2008使用体验</title>
		<link>http://weishijun.com/p/247</link>
		<comments>http://weishijun.com/p/247#comments</comments>
		<pubDate>Sat, 09 May 2009 09:56:50 +0000</pubDate>
		<dc:creator>魏 拾俊</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[程序设计]]></category>

		<guid isPermaLink="false">http://weishijun.com/p/247</guid>
		<description><![CDATA[Visual Studio 2008使用体验
为了是程序具有Vista界面，尤其是一些通用对话框，例如打开/保存文件对话框，安装Visual Stuido 2008进行升级（未安装VS2008Sp1）。
安装后，遇到以下问题
1：VS2008里面的ATL，少了一些文件，缺少的这些文件，被当成ATL Server作为开源软件发布了。下载ATL Server源代码可以解决。
2：VS2008不再使用/wp64参数，编译的时候。会出现很多警告。用VS2008打开所有的vcproj文件（作为XML文件打开），全部替换里面的Detect64BitPortabilityProblems=&#8221;true&#8221;为空，保存文件。
3：其他一些比较简单的兼容问题，例如某些类型重复定义，很容易解决。
4：编译工程的时候，出现了很多编译器错误问题。
下载
http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=11399
http://code.msdn.microsoft.com/KB946040/Release/ProjectReleases.aspx?ReleaseId=921
安装这两个补丁后，解决编译出错问题。
目前未发现其他问题。
]]></description>
		<wfw:commentRss>http://weishijun.com/p/247/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

