|
i have added a resource symbol to the dialog and have added it to string table and i did the following code to have progressbar in status bar,but it does work,y is that so???i need to display the progressbar when i click the cancel button.
CStatusBar m_wndStatusBar;
static UINT BASED_CODE indicators[] =
{
PROGRESS
};
void progress::OnBnClickedOk()
{
m_bCreated = FALSE;
RECT MyRect;
m_wndStatusBar.GetItemRect(0, &MyRect);
if (m_bCreated == FALSE)
{
m_Progress.Create(WS_VISIBLE|WS_CHILD, MyRect, &m_wndStatusBar, 1);
m_Progress.SetRange(0,100);
m_Progress.SetStep(10);
m_bCreated = TRUE;
}
void progress::OnBnClickedCancel()
{
for (int I = 0; I < 100; I++)
{
Sleep(20);
m_Progress.StepIt();
}
RAJA
|
|
|
|
|
The problem is that you are stepping the progress bar in a loop with a sleep between each step. It can't work because no messages are processed anymore (the message loop is in the same thread). So, your progress bar won't step and your UI will be freezed during that time.
What you need to do is to have a separate thread that does the processing (here, the for loop) and send a user defined message to your window so that it can step the progress bar.
|
|
|
|
|
hey, is Projet RAJA the same guy as you ?
why don't you follow the same thread ???
|
|
|
|
|
toxcct wrote: why do you use several accounts ?
He's just changed his display name.
A 'C' question asked in the Visual C++ forum:
Title: please stomuch me
if i have
string s[7];
s[1]="hello"
...
s[7]="how are you"
can i trace s[1] by loop and select specified item as example i, want to select e from s[1]="hello"..... the question is : this process possible or impossible!? I hope help me.......thanks - sofia_111
|
|
|
|
|
Rajesh R Subramanian wrote: He's just changed his display name
i figured that out, before you post... check again
btw, your sig is a bit too big, isn't it ?! lol
|
|
|
|
|
toxcct wrote: btw, your sig is a bit too big, isn't it ?! lol
Actually, that is a condensed version of the actual content.
A 'C++' question asked in the Visual C++ forum:
Title: please stomuch me
if i have
string s[7];
s[1]="hello"
...
s[7]="how are you"
can i trace s[1] by loop and select specified item as example i, want to select e from s[1]="hello"..... the question is : this process possible or impossible!? I hope help me.......thanks - sofia_111
|
|
|
|
|
I think yeah I dont know why in these days some people want to make progressbar in the statusbar.
|
|
|
|
|
since we are performing a task that would take some time, we are pushed to inform user about the process progress, through the status bar. Please help na!
thanks,
Mohanraj D
Raja
|
|
|
|
|
|
I want to help you but I told you previous your code is working for me and also I told that you can change to other place than OnInit.
|
|
|
|
|
|
We have a forum for Windows forms[^] and you'll need to ask it there to get an answer.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
I guess your question wasnt connected(of answers to your reply) but anyway you dont delete your question.
|
|
|
|
|
Just kidding
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi all,
Can anybody tell me how to open a single instance of a application????
And if a instance is running and if we click the exe then the running exe should show up.
how can i do so???
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Yes, Joseph M. Newcomer [^] can.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
You beat me to it.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: You beat me to it.
drugz, u know
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
|
|
Dear developers,
I have the following code:
try {
ifstream file;
file.open("file.txt");
file >> ... ;
file.close();
}
catch(......) {
...
---> do I have to close the file here? <----
}
My question:
Do I have to close the file in the catch-handler? Or is it automatically closed when the destructor of file runs.
Kind regards
PS:
Another question: How can I insert code here with indentation?
modified on Tuesday, May 6, 2008 7:06 AM
|
|
|
|
|
Tomerland wrote: ry {
ifstream file;
file.open("file.txt");
file >> ... ;
file.close();
}
catch(...) {
...
---> do I have to close the file here? <----
}
You won't possibly know the exception that took you into the catch block, since you are catching every possible exception. What if the file wasn't opened and the exception is a FileNotFound one? Dear God, No!
Tomerland wrote: Another question: How can I insert code here with indentation?
Enclose the code within the <pre> </pre> tags.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Tomerland wrote: Or is it automatically closed when the destructor of file runs.
Why don't you try?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Tomerland wrote: Do I have to close the file in the catch-handler?
if the file was successfully opened, yes, otherwise, no !
Tomerland wrote: Or is it automatically closed when the destructor of file runs
nop. and as long as you don't know where the exception were thrown, you can't bother about that...
|
|
|
|