Click to See Complete Forum and Search --> : How to create multitasking in the window?


Profesor
May 10th, 1999, 10:34 AM
I use VC++ 5.0, MFC 4.21.

I have a function, which archives a database and writes in the window resources. But, function does not give a focus to window to use controls (buttons etc.). Why or how to correctly program it?

I use modalless dialog by:

m_pArchivDlg->Create(IDD_ARCHIVEDIALOG);
m_pArchivDlg->ShowWindow(SW_SHOW);
m_pArchivDlg->UpdateWindow();

... and now continues long procedure, which using ODBC archives a database.
I can change a static text by:
m_pArchivDlg->m_StaticTable.SetWindowText(TEXT);
but this is all!

PChetan
May 10th, 1999, 12:57 PM
Hi,
i guess by creating a separate worker thread for your database work may solve your problem, try to get help on AfxBeginThread().

Thanks
Chetan

Nothing is imposible.

sinisa
May 10th, 1999, 03:45 PM
i think it is maybe easier to put in your big loop some message dispatcher that will check for messages and post them to the window.. In that way you will be able to communicate with your dialog while he is processing the data..
Sini

Chetan
May 10th, 1999, 08:31 PM
Yap, if you can use PeekMessage or something similar to that and solve your problem then definitely this method should be the first choice over creating all together different thread as creating a thread is definitely an overhead.

Chetan

Practice makes the man perfect.