一个包含bar和取消而且不需要资源弹出窗口

1.构造函数

CProgressWnd();
CProgressWnd(CWnd* pParent, LPCTSTR strTitle, BOOL bSmooth=FALSE);
BOOL Create(CWnd* pParent, LPCTSTR strTitle, BOOL bSmooth=FALSE);

参数说明:

pParent//父窗口
strTitle//窗口标题
bSmooth//是否平滑

2.方法属性

BOOL GoModal(LPCTSTR strTitle = _T("Progress"), BOOL bSmooth=FALSE);
// Make window modal int SetPos(int nPos); // Same as CProgressCtrl
int OffsetPos(int nPos); // Same as CProgressCtrl
int SetStep(int nStep); // Same as CProgressCtrl
int StepIt(); // Same as CProgressCtrl
void SetRange(int nLower, int nUpper, int nStep = 1);
// Set min, max and step size void Hide(); // Hide the window
void Show(); // Show the window
void Clear(); // Clear the text and reset the
// progress bar
void SetText(LPCTSTR fmt, ...); // Set the text in the text area BOOL Cancelled() // Has the cancel button been pressed? void SetWindowSize(int nNumTextLines, int nWindowWidth = 390);
// Sets the size of the window
// according to the number of text
// lines specifed and the
// desired window size in pixels. void PeekAndPump(BOOL bCancelOnESCkey = TRUE);
// Message pumping, with options of
// allowing Cancel on ESC key.

SetWindowSize()默认显示四行

PeekAndPump()防止消息阻塞,在走进度过程中,相关操作可以继续执行,如esc取消,鼠标点击等等

3例子

通过GoModal()显示

CProgressWnd wndProgress(this, "Progress");

// wndProgress.GoModal(); // Call this if you want a modal window
wndProgress.SetRange(0,5000);
wndProgress.SetText("Processing..."); for (int i = 0; i < 5000; i++) {
wndProgress.StepIt();
wndProgress.PeekAndPump(); if (wndProgress.Cancelled()) {
MessageBox("Progress Cancelled");
break;
}
}

或者Create()

CProgressWnd wndProgress;

if (!wndProgress.Create(this, "Progress"))
return; wndProgress.SetRange(0,5000);
wndProgress.SetText("Processing...");

源代码链接地址:http://download.csdn.net/detail/wuyuan2011woaini/9594242

A Popup Progress Window的更多相关文章

  1. Popup a window before the MainWindow

    protected override void OnStartup(StartupEventArgs e) { Window w = new Window(); w.ShowDialog(); bas ...

  2. Pass value from child popup window to parent page window using JavaScript--reference

    Here Mudassar Ahmed Khan has explained how to pass value from child popup window to parent page wind ...

  3. BOM 浏览器对象模型_window 对象的常见 window.属性_window.方法

    1. 常用属性 window.devicePixelRatio        像素比 = css / 物理像素 window.scrollX,window.scrollY    滚动条 卷曲距离 if ...

  4. WPF Popup全屏 弹出方法。解决只显示75%的问题。

    WPF Popup全屏 弹出方法.解决只显示75%的问题.   WPF 中 Popup 有一个特点.当Popup的高度超过屏幕的75%的时候,只显示75%的高度. 如下代码: <Window x ...

  5. popup的简单应用举例(具体在增删改查组件中用到)以及补充的知识点

    一.首先说一下自执行函数 1. 立即执行函数是什么?也就是匿名函数 立即执行函数就是 声明一个匿名函数 马上调用这个匿名函数 2.popup的举例 点击,弹出一个新的窗口.保存完事,页面不刷新数据就返 ...

  6. python 全栈开发,Day117(popup,Model类的继承,crm业务开发)

    昨日内容回顾 第一部分:权限相关 1. 权限基本流程 用户登录成功后获取权限信息,将[权限和菜单]信息写入到session. 以后用户在来访问,在中间件中进行权限校验. 为了提升用户体验友好度,在后台 ...

  7. window.open() & iframe

    window.open() & iframe https://www.w3schools.com/jsref/met_win_open.asp window.open(URL, name, s ...

  8. popup的简单应用举例

    一.首先说一下自执行函数 1. 立即执行函数是什么?也就是匿名函数 立即执行函数就是 声明一个匿名函数 马上调用这个匿名函数 2.popup的举例 点击,弹出一个新的窗口.保存完事,页面不刷新数据就返 ...

  9. WPF popup控件的使用

    <Window x:Class="WPFPopup.RuntimePopup"     xmlns="http://schemas.microsoft.com/wi ...

随机推荐

  1. 更加优雅地搭建SSH框架(使用java配置)

    时代在不断进步,大量基于xml的配置所带来的弊端也显而易见,在XML配置和直接注解式配置之外还有一种有趣的选择方式-JavaConfig,它是在Spring 3.0开始从一个独立的项目并入到Sprin ...

  2. 0422 Step2-FCFS调度

    一.目的和要求 1. 实验目的 (1)加深对作业调度算法的理解: (2)进行程序设计的训练. 2.实验要求 用高级语言编写一个或多个作业调度的模拟程序. 单道批处理系统的作业调度程序.作业一投入运行, ...

  3. AC自动机 - 多模式串匹配问题的基本运用 + 模板题 --- HDU 2222

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  4. 移动web开发总结

    让网页的宽度自适应屏幕<meta name="viewport" content="width=device-width"/>   1)html上加 ...

  5. sqlserver工作日常使用sql--持续完善中

    select STUFF('232',1,1,'')结果为32,从第一个字符开始去掉一个字符,及去掉 select CONCAT('-','asd')结果为-asd,连接两个字符串 select co ...

  6. 重新想象 Windows 8 Store Apps (60) - 通信: 获取网络信息, 序列化和反序列化

    [源码下载] 重新想象 Windows 8 Store Apps (60) - 通信: 获取网络信息, 序列化和反序列化 作者:webabcd 介绍重新想象 Windows 8 Store Apps ...

  7. 从几篇文字得到关于web app开发的性能问题的答案

    1. http://blogs.adobe.com/creativecloud/are-mobile-web-apps-slow/ 2. http://software.intel.com/zh-cn ...

  8. 线段树或树状数组---Flowers

    题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=4325 Description As is known to all, the blooming tim ...

  9. php实现快速排序

    下午练习时候,把经典排序快速排序做了,以下是我的代码 <?php /** * Created by PhpStorm. * User: Administrator * Date: 16-8-29 ...

  10. 开源项目Foq简介

        Foq是一个轻量级-线程安全的mocking类库.使用它来mock抽象类与接口这是我们通常的做法.Foq的名字来自Moq,如果你使用过Moq的话,自然后联想到它能做什么.Foq主要是为了F#的 ...