Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problems with local data

Posted on 2000-02-16
3
Medium Priority
?
160 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

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

618 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