Solved

Problems with local data

Posted on 2000-02-16
3
148 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
3 Comments
 
LVL 9

Expert Comment

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

Accepted Solution

by:
VinExpert earned 10 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now