Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...The forum looks great! You guys have done a fantastic job on arranging things there...Your site is very precise and fun to visit..."

Geography

Where in the world do Tek-Tips members come from?
HyperEngineer (Programmer)
16 Feb 09 17:39
I have an application that starts a thread.  In that thread I open a dialog box in modal mode.  Then I try to update a Static control.  Here are some code snippets.

This is in the main dialog:

CODE

CTest Test;
hTestSequenceThread = (HANDLE)_beginthread(Test.TestSequencer, 0, (void*)this);

This is in Test.TestSequencer:

CODE

CLed LED;
INT_PTR nResponse = LED.DoModal;

Then in the child dialog box in a function called by the constructor:

CODE

CStatic* promptmessage;
promptmessage = (CStatic*)GetDlgItem(IDC_PROMPT);
promptmessage->SetWindowTextA("Prompt Message");
The GetDlgItem() line gives and assertion

Alternatively, I added a member variable m_Prompt then used the following in the function:

CODE

m_Prompt = "Prompt Message";
UpdateData(FALSE);
Here the UpdateData() function gave and assertion.

How do I access the controls in the child window from the child window?

Thanks,

HyperEngineer
If it ain't broke, it probably needs improvement.

victorv (Vendor)
25 Feb 09 15:38
hi,
Static is "static" !

Workaround this, using a normal Edit control,
removing box (frame) and setting backgrond as the dialogbox:
declare it read-only, no tabstop. winky smile

ciao
vittorio
level2programmer (Programmer)
15 May 09 11:59
Don't do it in the constructor.  Do it OnInitDlg().  The objects don't necessairly exist yet.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close