Re: AfxBeginThread
- From: fojimais@xxxxxxxxxxxxx
- Date: Wed, 08 Nov 2006 16:46:10 -0600
Helo Alir,
Please sir, I trying my best to learn form masters like you. Not
trying to waste your time, I am very grateful and can hope to do you
faveor some day also.
I have a dialog applicaiton , with a button, when this button is
clicked it does many task, like open this, write that etc, while this
processing is happening I want to show popup dialog box which has
static text that show what the main dialog is doing. for example,
"please wait...opening file" then update this static texts as
different task is done. I was told I will need to use UI thread to
make this popup dialog and update it as well.
Please help me
Tatiana
On Wed, 8 Nov 2006 16:02:31 -0600, "AliR \(VC++ MVP\)"
<AliR@xxxxxxxxxxxxx> wrote:
What is it that you are trying to learn using threads or using dialog box?.
1. When you want to change the text of a static control on a dialog, open
the dialog in the resource editor, give the control an id other than
IDC_STATIC. Right click on it and select Add Variable, and give it a name
like m_Title. Then within your CDialog derived class you can change its text
by calling m_Title.SetWindowText("This is a test");
2. Seeing that you have it within a thread you will have to do some more
work. First of all in a thread you shouldn't make the dialog a Modal
dialog. Second you will need to make the variable a member variable of the
thread class. After that and steps in step 1, you an write a pass-throught
method in your CWinThread derived class that sets the static text of the
dialog. This way you can set the static text from the main thread.
AliR.
<fojimais@xxxxxxxxxxxxx> wrote in message
news:kph4l214919m8shsitguejiocvl0aprmg5@xxxxxxxxxx
Hi
First please forgive me if this is too beginner question, just trying
to learn.
I have a dialog application with a button on it called "SHOW". In the
on click event of this button, I have the following code:
AfxBeginThread(RUNTIME_CLASS(CMyTestDlg));
The CMyTestDlg class is derived from CWinThread. In the
CMyTestDlg::Initinstance I have
{
CSomeDialog dlg1; //a regualr dialog made with resource editor
//and has a static text contol on it (IDC_STATIC_TEXT1) assigned
//member variable m_dlgtext of type CString
dlg1.DoModal();
}
Now when I click on the SHOW button on my main dialog , it shows the
dialog (dlg1 - CSomeDialog) - no problem here.
My lack of knowledge is how to access the static text control on the
dlg1.
Please if anyone can help, I would be very grateful!
Tatiana
- Follow-Ups:
- Re: AfxBeginThread
- From: Michael Archon Sequoia Nielsen
- Re: AfxBeginThread
- From: Dan Bloomquist
- Re: AfxBeginThread
- From: David Wilkinson
- Re: AfxBeginThread
- From: AliR \(VC++ MVP\)
- Re: AfxBeginThread
- References:
- RE: AfxBeginThread
- From: fojimais
- Re: AfxBeginThread
- From: AliR \(VC++ MVP\)
- RE: AfxBeginThread
- Prev by Date: Re: AfxBeginThread
- Next by Date: Re: AfxBeginThread
- Previous by thread: Re: AfxBeginThread
- Next by thread: Re: AfxBeginThread
- Index(es):