Solved

EXTERN

Posted on 1998-11-24
2
248 Views
Last Modified: 2010-04-01
Hi... I have a dialog based MFC application with a button on it that opens a property sheet with four pages. I want to use a variable in the dialog and I want to use the same variable in  the property sheet. So if I have a variable x in the dialog, and I try to use it in the property sheet, I must be able to have the variables value. At the moment I am using the EXTERN definition. Is there another nicer way because I don't like EXTERN. Thanks
0
Comment
Question by:rose337
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
cyrilbdt earned 50 total points
ID: 1178550
CMyDlg::OnButton1()
{
 CMyPropSheet sheet;
 CPage1 page1;
...
 page1.m_x = m_x;
 sheet.AddPage(&page1);
..
 if(sheet.DoModal() != IDOK)
  return;
 m_x = page1.m_x;
 .....
}


0
 
LVL 2

Expert Comment

by:rayb
ID: 1178551
No disrespect to cyrilbdt, but a slightly slicker method would be to write your pages to accept a pointer or a reference to your variable.  That way the pages can update the variable directly.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need some help with Microsoft Visual Studio C++ 2003 5 85
Unable to start eclipse ? 17 170
FMX TCameraComponent Problem 2 104
Indy 10 not Receiving UDP broadcast 3 51
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question