?
Solved

Problems with local data

Posted on 2000-02-16
3
Medium Priority
?
157 Views
Last Modified: 2013-11-20
I want to create a window, but the window needs data from upper class (CMainFrame). How can I be able to get data from this class outside into my CWnd-OnPaint function ?
0
Comment
Question by:alexott
[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
3 Comments
 
LVL 9

Expert Comment

by:cdesigner
ID: 2529736
set data in you window creation
0
 
LVL 8

Accepted Solution

by:
VinExpert earned 20 total points
ID: 2529744
Hi,

I assume that, u have created the window. and u have the CWnd class for it. Then add a include as
#include "MainFrm.h" to its class

Then say u want to access the data in mainframe which is a string by name m_strData.

Then whenever u want to access the string do

CMainFrame *p_Main = (CMainFrame *)AfxGetMainWnd();
p_Main->m_strData will give u that variable.

Hope this helps.
VinExpert
0
 
LVL 5

Expert Comment

by:Wyn
ID: 2529748
Using a global variable.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 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