Click to See Complete Forum and Search --> : Display "Please wait....."


Kelvin
May 5th, 1999, 05:34 AM
I would be grateful if someone can provide some tips for me,

I want to display a status like "Please Wait...."or some GUI on the screen while my program running behind and get the job done,
do i need to use multithreading for this? How easily this can be implemented? How about using MFC..>??
Any code...for example?

Thank You!!

Ashley Antony
May 5th, 1999, 06:12 AM
This can be easily accomplished with a PeekMessage() loop in your code.

Ashley.Antony@in.bosch.com
Bangalore,
India.

shridhar rao
May 5th, 1999, 06:50 AM
You'll have to do it using threads. have a thread waiting for an event. When this event is set. display the dialog box. Once your operation is complete, set the event again this event should destroy the dialog box.

I hope this solves your problem

Ashley Antony
May 5th, 1999, 11:24 PM
For the best system performance, you should try to make it run with minimal threads. When you create a thread system is doing a lot things behind the screen. There are situations like this where you can easily avoid another thread. PeekMessage() is the solution for that. It is how Windows 3.1 applications showing the Cancel button. You can set a boolean variable in the click event of the cancel button, and check for the state of the variable inside the main function. The same can be extended to Win32 also. Please read VC++ help for this. One drawback with PeekMessage() is that you will have to sprinkle it around your code, but beauty of the code counts only after the performance beauty. If you couldn't succeed to do it please let me know.

Ashley.Antony@in.bosch.com
Bangalore
India.

Saeed R
May 13th, 1999, 09:57 PM
1-Create a Dialog and stick a text into it say"Please wait..."
2-remove any OK /Cancel button
3-call this dialog in modeless mode...
4-do your stuff
5-kill the modeless dialoge..



here is a typical code

BOOL CWaitDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
CenterWindow(CWnd::GetDesktopWindow());//center dialog against the whole desktop window

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CWaitDlg::Create()
{
return CDialog::Create(CWaitDlg::IDD);
}

now in the mother code do something like this
remeber :CWaitDlg *waitdlg;
therefore:
waitdlg=new CWaitDlg();
waitdlg->Create();
ret = pItem->m_pTangoReport-> submit(heavystuff);//takes a long time
delete waitdlg;

Wayne Fuller
May 13th, 1999, 10:36 PM
It looks like everybody is making this more complicated
then it needs to be. Just create a modeless dialog box
before you do your intensive work and then destroy it
when you are through.

Wayne

BrianOG
May 14th, 1999, 04:29 AM
Display a wait cursor (CWaitCursor) & change the text in the status bar to say Please wait....
Then, when finished, change the text back to Ready.