-
February 12th, 2014, 06:41 PM
#1
pass parameter in oninitdialog
Hello,
Thank you very much for taking time from you busy day to help me out. I very much appreciate it. I need to pass a variable to a dialog box.
Code:
Doc* pDoc;
Dialog dlg;
int input = dlg.DoModal();
When I call dlg.DoModal() I need to somehow pass the pDoc into the dialog box. Everything I need the variable for is taking place inside the oninitdialog function. Is there anyway to pass the variable to that function? Again thank you very much for the help.
-
February 12th, 2014, 07:36 PM
#2
Re: pass parameter in oninitdialog
Originally Posted by Gregorina
Hello,
Thank you very much for taking time from you busy day to help me out. I very much appreciate it. I need to pass a variable to a dialog box.
Code:
Doc* pDoc;
Dialog dlg;
int input = dlg.DoModal();
When I call dlg.DoModal() I need to somehow pass the pDoc into the dialog box. Everything I need the variable for is taking place inside the oninitdialog function. Is there anyway to pass the variable to that function? Again thank you very much for the help.
You can't. Typically you'd create a member variable in Dialog, such as
Doc* m_pDoc;
Then your code would look like
Code:
Doc* pDoc;
Dialog dlg;
dlg.m_pDoc = pDoc;
int input = dlg.DoModal();
Then you'd access m_pDoc from OnInitDialog.
-
February 12th, 2014, 07:56 PM
#3
Re: pass parameter in oninitdialog
Wow that was easy. Thank you. Don't know why I didn't think of that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|