|
Could you describe exactly what's happening and what you expect ?
The code that was given to you as example should print "in progress" in the status bar for 5 seconds (depends of the Sleep time) and then it will be replaced by "sucess".
What happens if you just take the code that was given to you and remove your call (just keep the SetPaneText calls and the Sleep) ?
|
|
|
|
|
i have done the following in my code...and i have my progress bar too in my status bar in the second pane....i need "inprogress" to be displayed first and then the " complete" text...but inprogress doesn't get displayed...what should be done
void test::OnLbnSelchangeList1()
{
void (*ptr)(void )=function;
thread_data td;
while(1)
{
if(Complete == 1)
{
indx=list.GetCurSel();
s="in progress";
m_bar.SetPaneText(0,s);
td.threadentry=(LPTHREAD_START_ROUTINE)ptr;
td.hdArg=NULL;
td.udiCreationFlags=0;
CreateThread(NULL, 0, td.threadentry, td.hdArg, (unsigned long) td.udiCreationFlags, (td.udiThreadId));
pPrgCtrl->SetPos(0);
while(1)
{
if(Complete==1)
{
pPrgCtrl->StepIt();
break;
}
}
break;
}
}
Sleep(200000);
pPrgCtrl->SetPos(100);
printf(" complete\n");
s=" complete";
m_bar.SetPaneText(0,s);
}
Raja
|
|
|
|
|
Mohanraj D wrote: ...the s="in progress" doesn't get displayed and only "sucess" is displayed finally,what's wrong with the code.
What is the value of i ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i don't have an i in my code
Raja
|
|
|
|
|
Sure you do. Check again.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
What happens if you comment out the second SetPaneText() statement? Does "in progress" remain in the status bar?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
sorry...if i comment the secondsettext the first one is getting displayed ie in progress is displayed
Raja
|
|
|
|
|
Could it be that the code in between the two calls to SetPaneText() is just happening too fast?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
no,its a long process...it takes 3 to 4 mins
Raja
|
|
|
|
|
It sounds as though your long process is taking up all of the CPU such that the first SetPaneText() does not get a chance to paint (i.e., the WM_PAINT message has not been processed).
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
so ...what should be done to slove this problem???i need the gui updates to be shown along with the process
Raja
|
|
|
|
|
Mohanraj D wrote: so ...what should be done to slove this problem
I would use a secondary (worker) thread to do the work. That way the primary thread can remain responsive and handle painting.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi Friends,
Can I do something like this ? Is it portable across all platforms ?
<br />
int* ptr = new int();<br />
int& tmp = *ptr;<br />
delete &tmp;<br />
|
|
|
|
|
I am not sure about portability issue but is there any specific reason to do this? These kind of smart-ass statements makes code harder to read and maintain.
-Saurabh
|
|
|
|
|
My design of stuff is another issue.
Basic question here is
- is this a standard practice?
- Are there any issues?
|
|
|
|
|
It mostly depend if you are interested in generic programming and in having value vs pointer semantics.
until &*&x == &x whatever x, than what you did is true.
Of course if x overloads * and/or &, things may be not be as expected, but sometime this is wanted by certain generic algorithms.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
vikrams wrote: int* ptr = new int();
int& tmp = *ptr;
delete &tmp;
Another hint for not to be in trouble - if you delete by using reference, then the ptr variable will become a dangling pointer.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
M making a search application in that m using SHBrowseForFolder, while running the application, when we click on the BRowse button second time then i want the previous folder(which we selected when we pressed first time) should come as selected. But now Mycomputer is coming selected everytime i click the Browse button.
Please someone tell me how to do.
This is my current code
void CTestingDlg::OnBrowse() { BROWSEINFO bi; TCHAR szDir[MAX_PATH]; LPITEMIDLIST pidl;
|
|
|
|
|
Hi,
I am not sure there may be some standard method, but you can save the previously opened folder path in an INI file.
When open dialog next time, initialize BROWSEINFO->pidlRoot to the previously opened folder path from INI file.
Hope you got some idea..
Thanks,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
Most applications use registry to get the last file that was opened. You can then use a parameter in BrowseInfo to open the previously selected folder.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi all,
Now I m using VC++ 2005,i want to use keyboard fast asseccing on Button control, how can i do this?
When i m using the VC++ 2006 then there i m using & with the caption of button and the access of that button with the help of assigning buttons.
But it is not working in VC++ 2005.
Please help me for this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
|
Expecting good explanation
|
|
|
|
|