|
|
Comments and Discussions
|
|
 |

|
i'm curious why this program can not be used in VS2008
|
|
|
|

|
Thanks Chris... This is really cool.
Cheers
-Ranga
|
|
|
|

|
very nice, thanks
My Blog: http://cynicalclots.blogspot.com
|
|
|
|

|
Hi,
I added a pb in my app and it just freezes
void CMainFrame::ShowProgressBar()
{
m_bIsPBCanceled = false;
if(!wndProgress.Create(0, "TDO - KODAK RVG6000"))
return;
wndProgress.SetRange(0,90000);
wndProgress.SetText("Waiting for X-ray...");
for(int i=0; i<90000; i++)
{
wndProgress.StepIt();
if (wndProgress.Cancelled())
{
break;
}
}
wndProgress.DestroyWindow();
}
Anybody had same experience? Any ideas what could be causing the problem?
I also would like to know how to cancel it if i get a specific message from other object.
For instance, suppose m_bIsPBCanceled = true now, where m_bIsPBCanceled is public bool variable in CMainFrame.
Thanks in advance
|
|
|
|

|
The application source code compiled fine in VS 2008; however when I rebuild the project in VS 2008 and executed the application code for displaying the progress window, it crashes in
BOOL CProgressWnd::Create(CWnd* pParent, LPCTSTR pszTitle, BOOL bSmooth /* = FALSE */)
{ .
.
VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
..
}
Please help!
|
|
|
|

|
I tried dropping the two source files into my VC++ (Visual Studio 2005 Pro) project and including them, but I get over a hundred compile errors, the first (and seemly most symptomatic) being:
ProgressWnd.h(36) : error C2504: 'CWnd' : base class undefined
Research seems to indicate that this is an MFC vs. .NET compatibility problem and that I need to make some reference or set something in my project properties for it to work. I have tried copying lines from the demo's stdafx.h file into mine, but that produces errors such as "window.h is already included".
In the course of trying to correct this problem, I also somehow managed to get the following error:
fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll
version) requires MFC shared dll version. Please #define _AFXDLL or do not
use /MD[d] c:\program files\microsoft visual studio
8\vc\atlmfc\include\afx.h
but since playing around with the stdafx.h file, I have not been able to reproduce this error.
Do you know what could be causing these problems and how I can fix them?
Luke
|
|
|
|

|
Hi all,
I use the control in my solution, and when I should update the progress I add a SetText new string too. Look at the code:
CString tempProgress;
tempProgress.Format(_T("Loading file %d/%d...\n\nPlease Wait."), i, m_NumFiles);
m_pProgress->SetText(tempProgress);
m_pProgress->StepIt();
m_pProgress->PeekAndPump();
But when I run into this, I get very ugly flickering, and I have no idea how destroy it.
I also try to use Invalidate(FALSE), I also try to change the return of value of OnEraseBkgnd event, but no way.
Could you help me?
Thank you
Walxer
|
|
|
|

|
Thank you Chris for this control : The PeekMessage is the key to evry thing : sofar I use two thread, with the main thread creating the progress window, and the worker thread doing the job and reporting progress to the main.
Now evrything happen in one thread !
Thank you again.
|
|
|
|

|
I initiated the progress window in my MainFrm and it works great, but how do I access the same progress window from other parts of my program? I need a 2 part progress display. First half of my process is done in MainFrm and the other half is done in the other part of my program. I would like to update progress window text and continue stepping for the 2nd half of my process.
Ideally what I want to accomplish is to use same progress window for my entire process.
Great job on this Popup Progress Window!
WVP
|
|
|
|

|
Thanks. Clear and useful.
|
|
|
|

|
Hi,
Do you know how to do it in .NET Winforms?
_slav_
|
|
|
|

|
Nice work. it was amazing to my project!
Thanks
|
|
|
|

|
I tried to use this dialog in a worker thread, after I click the cancel button, the whole program stopped response until it totally finish, Can you solve the problem? Thanks
|
|
|
|

|
Hi there,
thank you for this great class!
Unfortunately the Progress Window crashes if i move the mouse over the Dialog.
I use this Dialog without a parent window. If the dialog runs without moving the mouse over it, it works fine.
If i debug my program i get stuck on this line:
AfxGetApp()->PumpMessage()
in the PeekAndPump method.
Any suggestions?
-- modified at 10:57 Wednesday 25th January, 2006
|
|
|
|

|
I downloaded the sample and it looks cool.
But whenever my code tries to initialize an object of class CProgressWnd, I get an Assert from winocc.cpp on line 279. I am trying to display the progress dialog from another modal dialog. I don't think this should be a problem though, should it ?
Perhaps I'm not passing the correct *Cwnd as the first parameter. I've tried "this" and "NULL" but neither seem to work. I'm using VC++ 6.0 with service pack 6. I would really appreciate any ideas that may help.
Thanks
Ethann
|
|
|
|

|
thanks for that - it's very convenient!
|
|
|
|

|
Hi!
I want to get information from a message box
you can help me
thans
|
|
|
|

|
Can this Class be used for Console Applications . If so can anyone pump one
example..
|
|
|
|

|
I haven't seen anyone else run into this problem, but I did so I thought I'd share in case it helps someone.
Scenario: When the user clicks a CBitmapButton button and the on-click handler displays the progress window, the button will show on top of the progress window
Workaround: After instantiating the progress window object, call SetWindowPos:
CTAProgressWnd wndProgress(NULL, "Progress");
wndProgress.SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
Cheers,
Tom Archer - Archer Consulting Group
Programmer Trainer and Mentor and Project Management Consultant
|
|
|
|

|
Got errors in VC++ 7, because CProgressCtrl was not defined.
Had to insert this line in ProgressWnd.h:
#include
Thanx for saving my time with this progress bar.
|
|
|
|

|
In the current multitasking environs its possible and usual to switch between programs , however when you have a long process ~ 5mins and you switch between programs the progress window stays on top .. on top of other programs such as outlook and internet explorer. is it possible to have the modal progress dialog block the use of the main dialog and stay on top of it but not go on top of other programs .... Any ideas ??
LK--<
|
|
|
|

|
Great class!
I have a suggestion for a small cosmetic fix though.
If I create the window using the standard constructor and then set the window size to suit my application, you can see a brief flash as the window is redrawn. The obvious solution is to call the default constructor, set the size, and then call the Create() function. Unfortunately, this doesn't work as the Create() function explicitly sets the width to the default of 390.
My suggestion is as follows:
1. Add a new member variable m_nWidth, initialising it to 390 in the CommonConstruct() function
2. In both constructors, provide parameters to set the width (and number of text lines).
3. In the Create() function, pass m_nWidth to both CreateEx() and SetWindowSize().
4. Add the following at the top of SetWindowSize():
m_nNumTextLines = nNumTextLines;
m_nWidth = nWindowWidth;
The result is that the window is drawn at the required width with the required height, first-time without having to resort to subsequent calls to SetWindowSize().
HTH
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|

|
I'm trying to use the CProgressWnd from within a thread and running into a lot of problems.
When the progresswnd is repainted (cover and uncover the progresswnd with another application) the application often crashes (both debug assert and in release mode) when receiving the WM_PAINT message for the progresswnd cancel button. This happens inside of the AfxWinProc callback. The callback is unable to find the window ptr for the cancel button thus dereferencing NULL.
Do you guys know what's going wrong? Is it okay to use the progressWnd from within a thread? It doesn't seem to crash when used outside of the thread...
Any help would be appreciated!
Thanks in advance!
|
|
|
|

|
There are many occasions where it's nice to have a poopup
I dunno man I personally prefer down as a direction myself...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|

|
Very useful class. However there's a little bug with the function Create:
BOOL CProgressWnd::Create(CWnd* pParent, LPCTSTR pszTitle, BOOL bSmooth )
It does not save the title the user gives ! I just added the following line somewhere in the function and it works just fine.
m_strTitle = pszTitle;
Jonathan de Halleux, Belgium.
|
|
|
|

|
Thanks Luke Gabello for the 'minor' mods.
(In my app I really see the difference and I'm happy with it )
Thanks Chris for posting them.
|
|
|
|

|
"There are many occasions where it's nice to have a poopup window..."
Um, I think you mean "popup window", right???
|
|
|
|

|
Small improvement
1. Progress window is visible at position X
2. Move the progress window to position Y
3. Press cancel
4. Let it pop up once again
5. It pops up at position X. Meaning it didn't save its position when you pressed the cancel button.
Reason:
SaveCurrentSettings() called in DestroyWindow() returns on its first line.
Solution:
Add
   SaveCurrentSettings();
as first line in OnCancel()
|
|
|
|

|
Hi Chris,
First of all: nice work.
I changed the label of the button to "&Stop" (in my case it is a stop rather than a cancel).
I expected the shortcut key Alt+S to work.
But it doesn't.
Any input to make it work quickly?
Thanks.
Geert.
|
|
|
|

|
The example behaves like my son when he was a teenager - it doesn't clean up after itself. Placing a cwnProgress.DestroyWindow() after the "for" loop does the trick.
|
|
|
|

|
I have an function and when I call the PrograssBar-function first this function starts and the the rest of m function:
Where I have to call the function?
int CSearch::SucheDateien(CString nextdir)
{
CString curdir = nextdir;
CString appname;
CString ftpfilename;
CString winfilename;
m_Ordner = nextdir;
CFileFind ftpFind;
BOOL bContinue = ftpFind.FindFile(curdir + "\\*.*");
while (bContinue > 0)
{
bContinue = ftpFind.FindNextFile();
appname = ftpFind.GetFileName();
if (appname == "." || appname == "..")
{
}
else
{
if (ftpFind.IsDirectory() != 0)
{
nextdir = curdir + "\\" + appname;
SucheDateien(nextdir);
}
else
{
if (m_filename.Find("*") == -1)
{
ID3_Tag myTag;
myTag.Link(ftpFind.GetFilePath(), ID3TT_ID3V2);
ID3_Frame *myFrame;
if (myFrame = myTag.Find(ID3FID_TITLE))
{
char title[1024];
myFrame->Field(ID3FN_TEXT).Get(title, 1024);
m_Title = title;
}
//CD Name:
//Recordset hinzufügen
AddRecord();
}
}
}
}
ftpFind.Close();
return 1;
}
I like to have the progress when starting the function above! Hope you can help me!
Andreas
|
|
|
|

|
Hi,
Jus wondering if anyone knows how we can include the timer count down in addition to the % increase to the progress window?
Rgds.
|
|
|
|

|
I have discovered the following feature:
while copying a file via the serial port
(with CProgressWnd showing the progress),
I was able to set focus to the main window,
select another file, and start a copy operation
on it before the first operation terminates.
(You see, you cannot copy two files
via the same serial port at the same time).
Probably, it's something wrong with PeekAndPump().
regards, Michael
|
|
|
|

|
I guess I'm being fussy, but when the parent window (a dialog) is on my secondary the pop-up is on the primary. If anyone knows what to change to make the pop-up display on the right screen it would be appreciated. Otherwise, I thought it was a very neat "drop-in" component. Congratulations to the author!
My system is PIII/1000 + G450 with 2 screens running Windows XP RC1.
|
|
|
|

|
Hello,
I try to use the SetRange(...) with nStep parameter > 1, and SetStep() method in order to control the progress of the bar. But instead of controlling the number of the steps within the whole 100%, I get (depend on the parameter), 2 to 1000 times or more times of th bar (i.e. counting to 5000%).
can anybody tell me how to solve it?
Thanks,
Kobi.
|
|
|
|

|
In some cases, SetFocus() method causes an assertion when m_hWnd is null. Change the following code at top of PeekAndPump():
void CProgressWnd::PeekAndPump(BOOL bCancelOnESCkey /*= TRUE*/)
{
if (m_bModal && ::GetFocus() != m_hWnd && m_hWnd)
SetFocus();
...
}
Marc
|
|
|
|

|
I can't seem to get it to work under CE. Anyone else had any success.
|
|
|
|

|
Thanks, Chris, for sharing your code. This is exactly what I was looking for and it saved me a lot of time and effort.
Good job!
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
A popup window containing a progress control and cancel button - no resource file needed
| Type | Article |
| Licence | CPOL |
| First Posted | 29 Nov 1999 |
| Views | 207,568 |
| Bookmarked | 133 times |
|
|