Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Handle of main dialog

Status
Not open for further replies.

HyperEngineer

Programmer
May 8, 2002
190
0
0
US


How do I get the handle of the main dialog box. I can't seem to use m_pMainWnd anywhere. If I do the compiler complains that it is an undeclared identifier. In the dialog project I have essentially:

MyApp
MyAppDlg
MyOtherClasses

I need to access the MyAppDlg from MyOtherClasses to change the text on the controls (labels, text boxes) of MyAppDlg.

Any help would be appreciated.



HyperEngineer
If it ain't broke, it probably needs improvement.
 
hi,
if you want change text in dialog box before launch it, you can refer them as:

CYourDlg dlg;
dlg.CStringVariableLinkedToEditControl = "value"
dlg.DoModal();

If you need chang them after the dlg is started,
it is not possible in a Frame with just a dialog Box.
You could do this using m_hWnd of the dialogbox, but
this variable is actualized after the dlg is started
and your programcounter is locked inside the dlg code.

The main app has no a its own Window and you cannot attach
it, for example a timer, to execute asynchronous code.

If you use a modless dialog box style (ie. AboutBox
launched modless from your dlg) you can pass the
m_hWnd of the dlg to the About dlg and change (from the child win) your dlgbox control properties.

bye
vittorio
 
I solved the problem for this application by the following:

Use FindWindow() to get the handle. I know the window text.

Next, use SetDlgItemText to change the text on the control.



HyperEngineer
If it ain't broke, it probably needs improvement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top