[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

EXTERN

Posted on 1998-11-24
2
Medium Priority
?
270 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 150 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

650 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