Directshow 通过 put_Owner 指定显示窗口后,自动刷新问题
在Directshow中,我们可以对render指定显示窗口,在写程序的过程中, 发现通过put_Owner设置的显示窗口存在自动刷新问题,譬如窗口被遮挡然后再次露出时,被遮挡部分不能自动刷新,需要拖动窗口进行刷新。
网上搜索了一下,找到了解决问题的办法:
http://blog.csdn.net/lemon_wei/archive/2008/02/29/2132195.aspx
具体处理方法:
假设图象窗口的picture控件id为IDC_FRAME_VIEW,
pViewWindon 为 IVideoWindow*接口,作四步处理
1、修改显示控件属性
CWnd* pWnd = GetDlgItem(IDC_FRAME_VIEW);
pWnd->ModifyStyle(0, WS_CLIPCHILDREN);
2、设置为子窗口的句柄
CWnd* pWnd = GetDlgItem(IDC_FRAME_VIEW);
put_Owner((OAHWND)pWnd->GetSafeHwnd( ))
3、OnPaint 不用动
4、OnEraseBkgnd 加如下代码
RECT rect;
CWnd* pWnd = GetDlgItem(IDC_FRAME_VIEW);
pWnd->GetWindowRect(&rect);
ScreenToClient(&rect);
pDC-> ExcludeClipRect(&rect);
return CDialog::OnEraseBkgnd(pDC);
其中的 ModifyStyle 中第二个参数dwstyle
- WS_BORDER
- Creates a window that has a thin-line border.
- WS_CAPTION
- Creates a window that has a title bar (includes the WS_BORDER style).
- WS_CHILD
- Creates a child window. A window with this style cannot have a menu bar. This style cannot be used with the WS_POPUP style.
- WS_CHILDWINDOW
- Same as the WS_CHILD style.
- WS_CLIPCHILDREN
- Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window.
- WS_CLIPSIBLINGS
- Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window.
- WS_DISABLED
- Creates a window that is initially disabled. A disabled window cannot receive input from the user. To change this after a window has been created, use EnableWindow.
- WS_DLGFRAME
- Creates a window that has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar.
- WS_GROUP
- Specifies the first control of a group of controls. The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style. The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys.
- You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use SetWindowLong.
- WS_HSCROLL
- Creates a window that has a horizontal scroll bar.
- WS_ICONIC
- Creates a window that is initially minimized. Same as the WS_MINIMIZE style.
- WS_MAXIMIZE
- Creates a window that is initially maximized.
- WS_MAXIMIZEBOX
- Creates a window that has a maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
- WS_MINIMIZE
- Creates a window that is initially minimized. Same as the WS_ICONIC style.
- WS_MINIMIZEBOX
- Creates a window that has a minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
- WS_OVERLAPPED
- Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_TILED style.
- WS_OVERLAPPEDWINDOW
- Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style.
- WS_POPUP
- Creates a pop-up window. This style cannot be used with the WS_CHILD style.
- WS_POPUPWINDOW
- Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.
- WS_SIZEBOX
- Creates a window that has a sizing border. Same as the WS_THICKFRAME style.
- WS_SYSMENU
- Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified.
- WS_TABSTOP
- Specifies a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style.
- You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use SetWindowLong.
- WS_THICKFRAME
- Creates a window that has a sizing border. Same as the WS_SIZEBOX style.
- WS_TILED
- Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style.
- WS_TILEDWINDOW
- Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style.
- WS_VISIBLE
- Creates a window that is initially visible.
- This style can be turned on and off by using ShowWindow or SetWindowPos.
- WS_VSCROLL
- Creates a window that has a vertical scroll bar.
Directshow 通过 put_Owner 指定显示窗口后,自动刷新问题的更多相关文章
- ASPX 关闭子窗口后自动更新父窗口
Response.Write("<script language:javascript>javascript:window.close();</script>&quo ...
- 黄聪:PHP如何实现延迟一定时间后自动刷新当前页面、自动跳转header("refresh:1;url={$url}");
//1秒后自动跳转 header("refresh:1;url={$url}"); exit; //1秒后自动刷新当前页面header("refresh:1;" ...
- Javascript实现页面加载完成后自动刷新一遍清除缓存文件
我们有些时候在加载页面时,会出现缓存文件对当前文件的表现效果有干扰,如有些缓存的样式文件会是页面效果发生改变,这时我们希望页面在加载时能自动刷新一遍清楚缓存文件. 但是由于跳转页面肯定会用到BOM部分 ...
- BrowserSync 热更新的使用(保存后自动刷新)
BrowserSync使用的优点,BrowserSync监听条件中的文件,发现更新会立刻刷新浏览器,就像 vue中的热更新一样,解放F5实现自动更新,提高开发效率, 解决了使用双屏幕时来回切换的烦恼! ...
- 问题解决——ShowWindow不显示窗口
配合任务栏通知区域. //MFC对话框程序 void CXXXDlg::OnShowHideUi() { // TODO: 在此添加命令处理程序代码 m_bShown=!m_bShown; ShowW ...
- gulp之压缩合并MD5清空替换加前缀以及自动编译自动刷新浏览器大全
gulp是基于流的前端构件化工具.目前比较火的前端构建化工具还是挺多的,grunt gulp fis3等等. 这个鬼东西有什么用?请参考https://www.zhihu.com/question/3 ...
- JAVA-JSP内置对象之response对象实现页面自动刷新
相关资料:<21天学通Java Web开发> response对象 实现页面自动刷新1.可以通过response对象的addIntHeader()方法添加一个标题为Refrsh的标头,并指 ...
- JSP中自动刷新
以下内容引用自http://wiki.jikexueyuan.com/project/jsp/auto-refresh.html: 细想一个显示在线比赛分数.股市状态或当前交易额的网页.对于所有这种类 ...
- nodejs里的express自动刷新高级篇【转载】
搬运自[简书:http://www.jianshu.com/p/2f923c8782c8]亲测可用哦! 最近在使用express框架及mongodb,由于前端和后端代码修改后都需要实现自动刷新功能,刚 ...
随机推荐
- C++ enum 作用域问题和解决方案
C++ 中的枚举类型继承于 C 语言.就像其他从 C 语言继承过来的很多特性一样,C++ 枚举也有缺点,这其中最显著的莫过于作用域问题--在枚举类型中定义的常量,属于定义枚举的作用域,而不属于这个枚举 ...
- web 性能优化指南阅读笔记
1.关于拥塞预防算法 PRR-比例降速,RFC6937 规定的一个新算法,其目标是改进丢包后的恢复速度,谷歌测量结果:该算法改进丢包造成的平均连接延迟减少了3%-10%.PRR是linux 3.2+内 ...
- oracle10g安装图解(win7)
一.Oracle10g 安装预备步骤取得 Oracle 10g 安装程序,或从 Oracle 技术网(OTN)下载光盘映像.在评估阶段您可以免费下载和使用无技术限制的全功能 Oracle,但在正式的商 ...
- js运算符(运算符的结合性)
1.javascript具有下列种类的运算符:算术运算符;逻辑运算符;比较运算符; 2.目的分类:字符串运算符;逻辑运算符;逐位运算符;赋值运算符; 3.特殊运算符:条件运算符;typeof运算符;创 ...
- Qt开发小工具之gif转换器(使用QMovie截取每一帧为QImage,然后用QFile另存为图片文件)
最近,QQ上好多各种gif表情.每一个都很经典呀..于是我就想把它转换成一张张静态图片...没学过ps.于是写了几行代码.完工.核心代码如下 主要是借助QMovie类.文件读取模式选择QMovie:: ...
- 进一步探索:Windows Azure 网站中解锁的配置选项
编辑人员注释: 本文章由 Windows Azure 网站团队的项目经理 Erez Benari 撰写. 在 Windows Azure 网站 (WAWS) 中管理网站时,许多选项可使用 Azu ...
- HDU 2147 kiki's game
题解:画图可得当横纵坐标均为奇数时为必败态…… #include <cstdio> int main(){ int a,b; while(scanf("%d%d",&a ...
- mac 下安装和卸载 mysql
这里有一篇文章写得很详细: http://www.cnblogs.com/macro-cheng/archive/2011/10/25/mysql-001.html 关于卸载,我也百度了下.找了好几个 ...
- Node.cluster
nodejs是一个单进程单线程的引擎,只能利用到单个cpu进行计算,面对当今服务器性能的提高,cpu的利用率显然对node应有的性能大打折扣,面对这个问题,cluster应运而生. cluster介绍 ...
- linux使用技巧(shell/vi/screen)
1,Shell bash > awk '{print {NF}}' file 此时想修改操作命令可参照下面快捷方式 ctrl a 光标移动到命令最前面 ctrl e 光标移动到命令最后面 ctr ...