CProgressbar and a Dialog window-- no refresh

Hello, I hope someone can answer this...( I posted this in vc.events too)
I have a modeless dialog box that contains a progress bar.  It works 
fine....when you don't touch it when it is updating.  But as soon as you move 
another window on top of it or try to move the window itself, it immediately 
stops refreshing.  -- Sometimes even the window will go blank.  The process 
still finishes, but the dialog box is dead.

Here is what I have done in the loop with the progress bar updating: 

p_dlg->Invalidate(TRUE);
p_dlg->UpdateWindow();   // these 2 lines don't do the trick, still same 
behavior

.... or...
p_dlg->UpdateData(false);	
p_dlg->UpdateWindow();    // still doesn't work

....or.... all 3 together
p_dlg->Invalidate(TRUE);
p_dlg->UpdateData(false);	
p_dlg->UpdateWindow();   // Nope, still not there yet!!

Even just the standard UpdateWindow() by itself will not work.  I have tried 
a lot more than this stuff and nothing works right.  Can anyone help me?

Thank you in advance for reading this.
0
RobKinney1 (47)
4/21/2005 8:45:05 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
524 Views

Similar Articles

[PageSpeed] 51

"RobKinney1" <RobKinney1@discussions.microsoft.com> wrote in message
news:AA7F53EC-129F-4A20-804F-BD7D40BA8E6A@microsoft.com...
> Hello, I hope someone can answer this...( I posted this in vc.events too)
> I have a modeless dialog box that contains a progress bar.  It works
> fine....when you don't touch it when it is updating.  But as soon as you
move
> another window on top of it or try to move the window itself, it
immediately
> stops refreshing.  -- Sometimes even the window will go blank.  The
process
> still finishes, but the dialog box is dead.
>
> Here is what I have done in the loop with the progress bar updating:
>
> p_dlg->Invalidate(TRUE);
> p_dlg->UpdateWindow();   // these 2 lines don't do the trick, still same
> behavior
>
> ... or...
> p_dlg->UpdateData(false);
> p_dlg->UpdateWindow();    // still doesn't work
>
> ...or.... all 3 together
> p_dlg->Invalidate(TRUE);
> p_dlg->UpdateData(false);
> p_dlg->UpdateWindow();   // Nope, still not there yet!!
>
> Even just the standard UpdateWindow() by itself will not work.  I have
tried
> a lot more than this stuff and nothing works right.  Can anyone help me?

Where are you doing your processing - is it in a thread, or in the window
iteslf? Which function is it in?

Brett.


0
bg8399 (8)
4/22/2005 3:52:29 PM
"Brett" wrote:

> Where are you doing your processing - is it in a thread, or in the window
> iteslf? Which function is it in?
> 
> Brett.

Brett, Good news!  I finally found something just this morning that I came 
accross by accident.  The good people at CodeGuru had an example of a message 
pump that needed to be done with a dialog box when a long process is taking 
place.  The code I used is:

(in my update progressbar loop I inserted) CheckAndPump();

(the check and pump function)
void CheckAndPump()
{
	// This is a modified YieldProc type function - it gets called often, but 
only
	// pumps the message que when REBPRGRS_PUMPINTERVAL has elapsed.
	DWORD dwNow = ::GetTickCount();
	if((dwNow - g_dwTime) >= REBPRGRS_PUMPINTERVAL)  // right now set to 2 
seconds
	{
		g_dwTime = dwNow;
		// pump message que
		MSG msg;
		while(::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
		{
			if(!AfxGetApp()->PumpMessage())
			{
				::PostQuitMessage(0);
			}
		}
		LONG lIdle = 0;
		while(AfxGetApp()->OnIdle(lIdle++));
	}

	return;
}

And there it is! It works wonderfully.  Thank you for responding Brett.  I 
really appriciate when peolpe respond to my posts. 

(if you want more info on the samplecode I was using, you can use the 
following link:   
http://www.codeguru.com/Cpp/W-D/dislog/progressindicators/article.php/c1999/ )
0
RobKinney1 (47)
4/22/2005 5:34:01 PM
Reply:

Similar Artilces:

MS Money 2006 Deluxe and Memory Problems -- Windows ME
Anyone else using MS Money 2006 Deluxe on a Windows ME platform?? Does anyone have any idea why this keeps locking up my computer?? I have tons of memory. I have a memory manager installed. I did discover that this thing was trying to get current market info -- I disabled that. I do not have direct access to my bank -- they're not up-to-speed yet. Any other ideas why this thing locks up near the beginning of the program opening?? Thanks. Barbara In microsoft.public.money, The Moose wrote: >Anyone else using MS Money 2006 Deluxe on a Windows ME platform?? > >Does anyone ...

Active chart refreshes slower in 2007
I create active charts with a spin button (Form control) to flip through many sets of y data (by incrementing the y-series row-references using an index controlled by the button). When I used Excel 2000, I used to place the button inside of the chart. (That is where you can only drag it as far as the edge of the chart area, much like placing a text box inside of a chart). By placing it inside, data series refreshed much faster than if it were outside (in the worksheet area itself). In the former case, I was able to flip through all series by holding down the mouse the spin button ar...

Office Windows not visible
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I have just installed the 2008 version but it was happening in my 2004 version too. When i open a document it doesn't show up / you can't see it. it is listed under 'window' as being open have to click click click around and don't even know what i last clicked on to get it to randomly appear, if at all.... in the 2004 version when it started doing it, i could go to 'window' and click 'bring all to front' but it doesn't work in 2008. its driving me nuts! any ideas what is happe...

how to get main window handle from processID
hi, I have a processId for a application, i want to to findout the application main window handle from it. how i can do that. I have tried using EnumWindow and GetThreadProcessID() function but that is not giving me expected results. the window handle retuns is not the main window handle from the GetThreadProcessID() function, but it is one of the window attached to process and whose parent is a desktop windo any pointer will be helpful Thanks in advance. On Mon, 14 Aug 2006 02:50:01 -0700, abhi <abhi@discussions.microsoft.com> wrote: >hi, > >I have a processId for a ...

comdlg32.ocx
I have used an application developed in Access 2003 very well. I bought a new machine with Windows 7 and reloaded Access 2003 (Office 2003). It now does not run a function within the application. I believe comdlg32.ocx is the problem. I unselected Microsoft Common Dialog Control 3.0 (SP3) and it has disappeared as well. Error Run time error 438 - Object does not support this property or object Function Private Function fileName() As String Me.CommandOpenFileDialogue.Filter = "Text|*.txt|All|*.*" Me.CommandOpenFileDialogue.ShowOpen fileName = Me.CommandOpenFil...

Email not refreshing unless switch views???
XP pro, Office XP installed and all updates on two machines. If they send each other an email via our exchange server they do not appear immediatly, even after repeated send and receives they dont show. That is unless you say switch to a calender and then back again and hey presto they appear. On the Win2000 system next door running Office 2000 its perfect, works like a dream, On the Office Xp systems they can sometimes "take" 20 mins to show up unless you switch views. I had hair once....now its falling out, anybody got any smart idea's of how i can solve this problem? Thanks...

Windows Server Enterprise and/or x64 editions at RMS
Will it work? I'm running SBS 2K3 with 4GB RAM (OS Max) on a 3.6Ghz P4 Xeon and this thing is just hammered. The server hosts one Store Ops DB and the HQ DB, plus HQ server. It runs an automated backup and hosts Wildfire (a private IM service). That's it. I don't run MS Exchange, I do have one printer queue that's hosted by the server, but it might print 50 pages on a busy day--many days it's none or just a few. I do host about 10 users' My Documents folders on the server, but even that traffic should be pretty easy for the server to handle. If I buy a new ...

where to purchase visio 2003 for use with windows 98 SE
I am using windows 98 SE and would like to install visio. When I went to comp usa, staples, etc. I was shocked to find that visio 2003 can only be used with win 2000/xp. Can anyone suggest a legitimate source where i could buy a new, unused copy of visio 2002 for use with win 98 and what a reasonable price is? Also, to qualify for the cheaper 'upgrade' version, what apps must already be installed? What are the requirements for the full, non-upgrade version, which will probably be about twice the price? thanks. ...

How to put limits on frame resizing when using splitter window?
Hi, I have a static splitter window in SDI. The right pane of the splitter is a CScrollView. The main frame is resizable. How do I prevent a user from resizing the frame so the right pane does not go beyond a given size?. The left pane's size is not important. I keep the frame size in check on splitter bar drag by calling ResizeParentToFit(TRUE) . Thanks, Bogdan As far as I know, you will have to override the WM_MOUSEMOVE message and do your limiting there. Basically what you will have to do is copy the content of CSplitterWnd::OnMouseMove into your CSplitterWnd::OnMouseMove ...

API hide access window
I have a question about using the API hide access window module. Thisworks ok for my forms, but the report preview window always getshidden or shows up behind the form. How can I use this module and havethe preview reports in front of the form? I use the code from thewebsite "The Access Web " to show only the active form, but iscumbersome to figure out how to effectively do a report preview andreturn to the previous form.Thanks,PC I haven't tried this so I'm guessing.Have you tried setting the report's Pop-Up property to True?Near as I can tell in order for the main windo...

Windows installer runs when opening Office 2003
I have both Office 2003 and Office 2007 installed on my XP Pro machine. Office 2007 is working just fine, but in the past month or so I see the Windows Installer preparing to install message every time I start Word, Excel, Access, or Publishing 2003. All four programs open after a minute or so; in Word I get an error message: "An error occurred and this feature is no longer functioning properly. Please run setup and select Repair." The other three programs do not display such a message. I have not installed Powerpoint 2003. I have tried running Setup from my Office 2...

cannot access office 2007 after windows update
i updated my windows and now every office program says" microsoft excel has not been installed for current user. please run setup to install the application" i cant access the setup You cannot access the Control Panel to get at Add or Remove Programs? Do you have an Office 2007 CD? Have you tried Start>Programs>Microsoft Office>MS Office Tools and run Diagnostics? Just for curiosity..........which Windows Update caused the problem? Gord Dibben MS Excel MVP On Sun, 10 Jan 2010 10:49:01 -0800, marco gueli <marco gueli@discussions.microsoft.com&g...

Very slooooooow File... dialogs in Office/Outlook 2003
Why is navigating between drives and directories using any of the File... dialogs in Office 2003 so slow? For instance, when I'm trying to insert/attach a file to a message (plain text, HTML - no difference) the navigation between directories on my local drives in the File Insert dialog takes forever - sometimes, literally, 20-30 seconds for each step! The File... (Open, Save As, etc.) dialogs work fast in other applications, and navigating between drives and directories in Windows Explorer is a snap but in Office it takes forever! I have 2 local drives (C & E) with lots of f...

ie8 for windows 2003
I have a windows 2003 server that is not networked nor am i permitted to it on a network and download the ie8 installation. Is there a way to download a full installation of ie8 from another computer that is networked for an offline installation on my non networked server? Thanks Is it not allowed to go on the internet? "Roger C" <RogerC@discussions.microsoft.com> wrote in message news:83770CA3-9749-4E02-A2AC-EEB56C4974B9@microsoft.com... :I have a windows 2003 server that is not networked nor am i permitted to it : on a network and download the ie8 installat...

How to split a dialog?
In .NET I have done this and it's very easy. But when I was asked to implement this in MFC, I was shocked to see nothing in the toolbox that looked like it could handle this. Obviously there is a way. I have see articles on CodeProject but I want to start with the basics. Can anyone suggest a good article/tutorial/sample that would show me how to have two controls on a dialog separated by a splitter and interactivly drag the splitter and have the controls resize accordingly? Thanks for any help, Steve "Steve" <sss@sss.com> wrote in message news:%23XuvhP8tFHA.1136@...

Small Business Server in Windows Server 2000 Environment
I have a requirement to install Microsoft CRM for about 10 CRM Users. The existing Windows 2000 has about 120 users with two Exchange Servers. Is it possible to set up a separate Small Business Server to run CRM within the Windows 2000 domain as this is the most cost effective way of implementing CRM for such a low User count? ...

FTP problem (directory listing) on Windows 2008/IIS7.5
So FTP works locally on server from command line perfect (server has publi IP adress)... but when I want to connect to the server from internet loginnm process is OK, but there is problem with receive directory list from the server (wait...wait..wait) I use the passive mode. The server configured in the IIS Manager tab FTP Firewall Support Date Chanell Port Range 49152-65535 firewall has open the above ports plus 20 and 21 (tcp) In addition when I switch firewall off it also does not work ... (I tested it on many computers connected to teh internet). Any ...

New unsolvable problem for bluescreen (Window vista)
My laptop is HP2133, with window vista (+service pack 1 & 2). I've had bluescreen a few times. The latest information of bluescreen (from event viewer) is: Fault bucket 0xD1_processr!ReadGenAddr+11, type0 Try replacing the RAM. "Woolf" <Woolf@discussions.microsoft.com> wrote in message news:072EC884-9598-4D0F-8B2D-BCFDA000C6EC@microsoft.com... > My laptop is HP2133, with window vista (+service pack 1 & 2). I've had > bluescreen a few times. The latest information of bluescreen (from event > viewer) is: Fault bucket 0xD1_processr!ReadGenA...

Word e-mail message window stops responding
Hello MS Word 2002 e-mail message window stops responding after coping and pasting in it. The Word is chosen in Outlook as an e-mail editor. The window appeared after clicking reply in the Outlook. -- Please, inform me of your reply: click Message menu, then 'Reply to all' in Outlook Express (this sends your reply to the newsgroups and to my email address at the same time) or inform me by sms to 79163876746 from www.mts.ru/sms or to my ICQ#135557327 or by messenger to kopnichev@hotmail.com Mr. Dmitriy Kopnichev e-mail: kopn@hotbox.ru Dimitry, - Upgrade to the latest service pack ...

sort order in the Checkbook Balance Inquiry window
Currently, the window sorts by this order: Document Date, Document Number, Deposit, then Payment The issue happens if a payment is entered, then a deposit, on the same day. This leads to incorrect Balance amounts in the inquiry window. The balance field displays the current checkbook balance, not the balance when computed as how we see it in the inquiry window. Logged for Lee Cheng Hoh - vsa case no 8821421 ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree...

windows xp pro with home ed coa ?
2 PART QUESTION (just realized large cap was on half way into posting) #1... i HAVE A COMPAQ COMPUTER WITH XP HOME. The restore discs have a ton of extra software that i'm not wanting. OK... i have a dell install disc with xp pro. Can i use the coa from the xp home edition? #2.... If the coa from a xp home edition won't work, can a coa from another xp pro computer work? -- x A common problem, that of 'adulterated' copies of Windows being supplied. IMHO the practice chould be prohibited. (Thinking about it, if I sold you a bottle of vodka which contain...

Hiden Dialog application
Hi, I have a dialog box application that the user can launch 'hidden'. Depending on parameters. I can, of course, read the parameters in my CWinApp::InitInstance() but then how can I create the dialog box so it is 'hidden', (and of course not hidden when the user did not enter the parameters). I can hide it after the 'DoModal' call but it does appear on the screen for a brief moment making the whole thing look a bit untidy. Many thanks Simon remove SWP_SHOWWINDOW flag from WINDOWPOS structure in WM_WINDOWPOSCHANGING message handler. void CXxxxDlg::OnWindowPosC...

To Do List Missing in Windows Live Desktop
I would like to have access offline to the to do list I am creating online through windows live but I cannot find where the to do list appears in Windows live Desktop. The Calendar events are syncing great - so it's not a problem with syncing - I simply can't see anywhere to access the to do list on WLD To Do is a web UI option, not locally available in Windows Live Mail. -- ...winston ms-mvp mail "timothy0072" <timothy0072@discussions.microsoft.com> wrote in message news:B82C97A8-9759-4BB2-B2C1-BE46E475728C@microsoft.com... > I would like t...

crm mobile 1.2 on Windows Mobile 5.0
Is there a way to make crm mobile work on windows mobile 5.0. Or are we stuck until 3.0 comes out? Thanks, josh CRM Mobile 1.2 only works on PocketPC 2003 You have to wait until CRM Mobile 3.0 comes out. That will work on Windows Mobile 5.0. Most likely in 3 months... Regards, -- Erik van Hoof CWR Mobility Check our weblog at: http://www.cwrmobility.com/weblog "jsooy" <jsooy@discussions.microsoft.com> wrote in message news:6183A543-A06A-4BBF-97A8-E45FC4CFF0CA@microsoft.com... > Is there a way to make crm mobile work on windows mobile 5.0. Or are we > stuck...

Scheduling Backup Window
Hoping for some advice on backup window. We do File System, System State, Database, and Mailbox-level backups every night. Full's once a week (though certain backups are always fulls by their nature) and Incremental's every day except the Full day. I was wondering two things: Is it bad to do backups during a maintenance period? I'm talking about online database maintenance. I guess the question also applies to message tracking too. With about 1200 users and 40 Gb data per server (there are 2 servers), how long should our maintenance window be? Our backups are taking longer...