<?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>MFC &#8211; WilliamKyle&#039;s Home</title>
	<atom:link href="https://www.williamkyle.com.cn/archives/tag/mfc/feed" rel="self" type="application/rss+xml" />
	<link>https://www.williamkyle.com.cn</link>
	<description>不积跬步，无以至千里；不积小流，无以成江海。</description>
	<lastBuildDate>Fri, 08 Apr 2022 14:37:54 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2.2</generator>
	<item>
		<title>Visual C++ 6.0 CDialogBar Create 出错解决方案</title>
		<link>https://www.williamkyle.com.cn/archives/141.html</link>
					<comments>https://www.williamkyle.com.cn/archives/141.html#respond</comments>
		
		<dc:creator><![CDATA[WilliamKyle]]></dc:creator>
		<pubDate>Mon, 27 Feb 2012 13:18:53 +0000</pubDate>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[编程]]></category>
		<category><![CDATA[CDialogBar Create]]></category>
		<category><![CDATA[MFC]]></category>
		<category><![CDATA[Visual C++ 6.0]]></category>
		<guid isPermaLink="false">http://www.williamkyle.com.cn/?p=141</guid>

					<description><![CDATA[今天打算弄一个工具栏，于是设计了一个对话框，然后建立一个 CDialogBar 对象，可是在 Create 的 &#8230; <a href="https://www.williamkyle.com.cn/archives/141.html" class="more-link">继续阅读<span class="screen-reader-text">Visual C++ 6.0 CDialogBar Create 出错解决方案</span></a>]]></description>
										<content:encoded><![CDATA[
<p>今天打算弄一个工具栏，于是设计了一个对话框，然后建立一个 CDialogBar 对象，可是在 Create 的时候老是出错，报错地点如下：</p>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="//www.williamkyle.com.cn/wp-content/uploads/ckfinder/images/141.jpg" alt=""/></figure></div>



<pre class="wp-block-code has-dark-gray-color has-text-color"><code lang="cpp" class="language-cpp">File:bardlg.cpp
Line:48</code></pre>



<p>然后看了一下别人的建立过程，发现别人建立对话框的时候，是直接建立的 <strong>IDD_DIALOGBAR</strong> 的对话框，于是比较了 <strong>IDD_DIALOGBAR</strong> 和 <strong>IDD_DIALOG</strong> 的各种参数，发现只要把建立的 <strong>IDD_DIALOG</strong> 对话框的属性改一下就可以了。<br /></p>



<p>样式：下层；边框：无；<br />更多样式：取消可见</p>



<p>其他的设置没有测试，默认的对话框按以上设置之后就能当作工具栏使用了。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.williamkyle.com.cn/archives/141.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>VC6 下通过 DirectShow 调用摄像头</title>
		<link>https://www.williamkyle.com.cn/archives/117.html</link>
					<comments>https://www.williamkyle.com.cn/archives/117.html#comments</comments>
		
		<dc:creator><![CDATA[WilliamKyle]]></dc:creator>
		<pubDate>Thu, 23 Feb 2012 15:19:08 +0000</pubDate>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[编程]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[DirectX]]></category>
		<category><![CDATA[MFC]]></category>
		<category><![CDATA[摄像头]]></category>
		<guid isPermaLink="false">http://www.williamkyle.com.cn/?p=117</guid>

					<description><![CDATA[首先，我们下载一下 DirectX 的 SDK 开发包，目前我们可以使用的是 DirectX 9.0 SDK（ &#8230; <a href="https://www.williamkyle.com.cn/archives/117.html" class="more-link">继续阅读<span class="screen-reader-text">VC6 下通过 DirectShow 调用摄像头</span></a>]]></description>
										<content:encoded><![CDATA[
<p>首先，我们下载一下 DirectX 的 SDK 开发包，目前我们可以使用的是 <a href="http://download.microsoft.com/download/7/e/9/7e9f48c6-f28a-469b-9b8e-cc84032efbd4/dxsdk_sum2004.exe">DirectX 9.0 SDK（Summer 2004）</a>之后的版本 DirectShow 已经被分离出去了。下载之后安装，安装前最好把 IDE 都给关了，免得路径没有添加进去。</p>



<h5 class="wp-block-heading"><strong>我们开始设计阶段：</strong></h5>



<p>我们先通过 MFC AppWizard(exe) 建立一个 MFC 的基本对话框，去除默认的两个按钮和文本，然后我们添加一个图像控件、一个组合框、一个按钮，然后设置属性，详情如下：</p>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="//www.williamkyle.com.cn/wp-content/uploads/ckfinder/images/clip_image001.png" alt=""/></figure></div>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="//www.williamkyle.com.cn/wp-content/uploads/ckfinder/images/clip_image002.png" alt=""/></figure></div>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="//www.williamkyle.com.cn/wp-content/uploads/ckfinder/images/clip_image003.png" alt=""/></figure></div>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="//www.williamkyle.com.cn/wp-content/uploads/ckfinder/images/clip_image004.png" alt=""/></figure></div>



<p>然后，我们通过类向导添加成员变量，详情如下：</p>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="//www.williamkyle.com.cn/wp-content/uploads/ckfinder/images/clip_image006.jpg" alt=""/></figure></div>



<h5 class="wp-block-heading"><strong>我们双击 Test</strong><strong>按钮，进入代码编写。</strong></h5>



<p>首先，我们把摄像头的两个文件加到项目路径下，然后再在文件视图里面添加这两个文件进项目。</p>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="//www.williamkyle.com.cn/wp-content/uploads/ckfinder/images/clip_image007.png" alt=""/></figure></div>



<p>然后，我们给窗口类的头文件里面添加引用</p>



<pre class="wp-block-code has-dark-gray-color has-text-color"><code lang="cpp" class="language-cpp">#include "CaptureVideo.h"</code></pre>



<p>接着，给窗口类添加一个私有的成员变量</p>



<pre class="wp-block-code has-dark-gray-color has-text-color"><code lang="cpp" class="language-cpp">private:
         CCaptureVideo m_cap;</code></pre>



<p>然后再在窗口初始化的时候，初始化设备列表</p>



<pre class="wp-block-code has-dark-gray-color has-text-color"><code lang="cpp" class="language-cpp">m_cap.EnumDevices(m_Device.GetSafeHwnd());
m_Device.SetCurSel(0);</code></pre>



<p>然后在按键的时候初始化摄像头就是的</p>



<pre class="wp-block-code has-dark-gray-color has-text-color"><code lang="cpp" class="language-cpp">m_cap.Init(m_Device.GetCurSel(),m_Screen.GetSafeHwnd());
m_OK.EnableWindow(FALSE);</code></pre>



<p>我的设计环境为 Windows 7 SP1 、 Visual C++ 6.0 SP6 ，借鉴的别人的程序，如果有其他问题，欢迎一起讨论。<br /><a href="//www.williamkyle.com.cn/wp-content/uploads/ckfinder/files/Cap.rar">源代码点击下载</a></p>



<hr class="wp-block-separator"/>



<p>关于出现以下错误的解决方案</p>



<pre class="wp-block-code has-dark-gray-color has-text-color"><code lang="bash" class="language-bash">C:\DXSDK\Include\strmif.h(1018) : error C2146: syntax error : missing ';' before identifier 'HSEMAPHORE'
C:\DXSDK\Include\strmif.h(1018) : fatal error C1004: unexpected end of file found
CapDlg.cpp
C:\DXSDK\Include\strmif.h(1018) : error C2146: syntax error : missing ';' before identifier 'HSEMAPHORE'
C:\DXSDK\Include\strmif.h(1018) : fatal error C1004: unexpected end of file found
CaptureVideo.cpp
C:\DXSDK\Include\strmif.h(1018) : error C2146: syntax error : missing ';' before identifier 'HSEMAPHORE'
C:\DXSDK\Include\strmif.h(1018) : fatal error C1004: unexpected end of file found
Generating Code...
执行 cl.exe 时出错.
</code></pre>



<p>在项目的 StdAfx.cpp 里面加上</p>



<pre class="wp-block-code has-dark-gray-color has-text-color"><code lang="cpp" class="language-cpp">#include "C:\DXSDK\Include\strmif.h"</code></pre>



<p>编译一次就好了，之后注释掉就好了。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.williamkyle.com.cn/archives/117.html/feed</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
