473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

classes in VC++

Hi

I have 3 classes:
- CMainFrame
- CPitApp
- CPitView

In class CPitApp i create object CMainFrame* pMainFrame = new
CMainFrame
and in class CMainFrame there is:
public:
int nIndex

And now the question

How can I refer in method OnPrint in class CPitView, that is
CPitView::OnPrint,
to a value of variable nIndex from class CMainFrame??

Is there a way of doing this without creating an object of class
CMainFrame or do i have to create it, and if so how to create it that
it will contains the same data that have object pMainFrame from
CPitApp??

I'm using MF. CMainFrame contains toolbar:
protected: CStyleBar m_wndStyleBar;
and CStyleBar have:
public:
CComboBox m_comboBox;

I simply want to use value returned by
m_wndStyleBar.m_comboBox.GetCurSel()
in method
void CPitView::OnPrint(CDC* pDC, CPrintInfo* pInfo)

Thanks.
Jul 22 '05 #1
6 1580
"Piotr Getka" <ro*******@wp.pl> wrote in message
news:d8**************************@posting.google.c om...
Hi

I have 3 classes:
- CMainFrame
- CPitApp
- CPitView

In class CPitApp i create object CMainFrame* pMainFrame = new
CMainFrame
and in class CMainFrame there is:
public:
int nIndex

And now the question

How can I refer in method OnPrint in class CPitView, that is
CPitView::OnPrint,
to a value of variable nIndex from class CMainFrame??

Is there a way of doing this without creating an object of class
CMainFrame or do i have to create it, and if so how to create it that
it will contains the same data that have object pMainFrame from
CPitApp??

I'm using MF. CMainFrame contains toolbar:
protected: CStyleBar m_wndStyleBar;
and CStyleBar have:
public:
CComboBox m_comboBox;

I simply want to use value returned by
m_wndStyleBar.m_comboBox.GetCurSel()
in method
void CPitView::OnPrint(CDC* pDC, CPrintInfo* pInfo)

Thanks.


Inappropriate newsgroup, try "microsoft.public.vc.mfc"

--
Elias
Jul 22 '05 #2

"Piotr Getka" <ro*******@wp.pl> wrote in message
news:d8**************************@posting.google.c om...
Hi

I have 3 classes:
- CMainFrame
- CPitApp
- CPitView

In class CPitApp i create object CMainFrame* pMainFrame = new
CMainFrame
and in class CMainFrame there is:
public:
int nIndex

And now the question

How can I refer in method OnPrint in class CPitView, that is
CPitView::OnPrint,
to a value of variable nIndex from class CMainFrame??
Is there a way of doing this without creating an object of class
CMainFrame or do i have to create it, and if so how to create it that
it will contains the same data that have object pMainFrame from
CPitApp??


I would not create it. CPitApp and CPitView have to have a way of
communicating with each other. Are they related in any way right now? Does
one inherit from the other? Does one include the other? If not, then you
need to give one of them a pointer to the other one, or you need to do it
from some main() or other function that has both of them in it. Then you
can add functions to them so that you can get pMainFrame from CPitApp and
pass it to CPitView.
Jul 22 '05 #3

"lallous" <la*****@lgwm.org> wrote in message
news:bu************@ID-161723.news.uni-berlin.de...

Inappropriate newsgroup, try "microsoft.public.vc.mfc"


<bzzzzzt> Knee-jerk response, and wrong answer. The real question doesn't
have anything to do with MFC.
Jul 22 '05 #4
jeffc wrote:

"lallous" <la*****@lgwm.org> wrote in message
news:bu************@ID-161723.news.uni-berlin.de...

Inappropriate newsgroup, try "microsoft.public.vc.mfc"


<bzzzzzt> Knee-jerk response, and wrong answer. The real question doesn't
have anything to do with MFC.


If we are nitpicking then it has everything to do with MFC
(The name of the classes are a strong indication that the OP is
using MFC. If on the other hand he built the classes on his own,
he wouldn't have that problem) and how the object hierarchy of MFC
works. The only thing the OP is missing are the functions AfxGetApp()
and AfxGetMainWnd() which open up the door to what the OP wants to do.
--
Karl Heinz Buchegger
kb******@gascad.at
Jul 22 '05 #5
"lallous" <la*****@lgwm.org> wrote in message news:<bu************@ID-161723.news.uni-berlin.de>...
"Piotr Getka" <ro*******@wp.pl> wrote in message
news:d8**************************@posting.google.c om...
Hi

I have 3 classes:
- CMainFrame
- CPitApp
- CPitView

In class CPitApp i create object CMainFrame* pMainFrame = new
CMainFrame
and in class CMainFrame there is:
public:
int nIndex

And now the question

How can I refer in method OnPrint in class CPitView, that is
CPitView::OnPrint,
to a value of variable nIndex from class CMainFrame??

Is there a way of doing this without creating an object of class
CMainFrame or do i have to create it, and if so how to create it that
it will contains the same data that have object pMainFrame from
CPitApp??

I'm using MF. CMainFrame contains toolbar:
protected: CStyleBar m_wndStyleBar;
and CStyleBar have:
public:
CComboBox m_comboBox;

I simply want to use value returned by
m_wndStyleBar.m_comboBox.GetCurSel()
in method
void CPitView::OnPrint(CDC* pDC, CPrintInfo* pInfo)

Thanks.


Inappropriate newsgroup, try "microsoft.public.vc.mfc"


Thanks. I'll try.
Jul 22 '05 #6

"Karl Heinz Buchegger" <kb******@gascad.at> wrote in message
news:40***************@gascad.at...
jeffc wrote:

"lallous" <la*****@lgwm.org> wrote in message
news:bu************@ID-161723.news.uni-berlin.de...

Inappropriate newsgroup, try "microsoft.public.vc.mfc"


<bzzzzzt> Knee-jerk response, and wrong answer. The real question doesn't have anything to do with MFC.


If we are nitpicking then it has everything to do with MFC
(The name of the classes are a strong indication that the OP is
using MFC. If on the other hand he built the classes on his own,
he wouldn't have that problem) and how the object hierarchy of MFC
works.


Only superficially. You would need to know the hierarchy regardless of
whether those are MFC classes. The fact that they are MFC classes are
incidental. The problem would be exactly the same if I inserted my made up
class names in there. It doesn't matter if he's using third party software
or his own - a valid response might be that we need to see the rest of the
code, but his question is still an OO C++ question, not an MFC question.
It's unnecessarily off-putting when people read little more than the subject
line and immediately decide to play net-nanny.
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Kevin Grigorenko | last post by:
Hello, I've been working on a little side project of mine in Visual Studio.NET for about the last month. Recently, I wanted a friend of mine to help me out with a problem and so I sent him my...
2
by: vemulakiran | last post by:
Hi all, I have doubt regarding .NET. I have a tool which was developed on VC++ 6.0(Win32 Application ). The application communicates with library (API) which was developed on VC++ 6.0 called core...
15
by: Edward Diener | last post by:
Why is it impossible to have a __value class instance variable in a __nogc class when it is possible to have a built-in type instance variable in a __nogc class ? __value class X { int a; };...
5
by: Anthony Evans | last post by:
Greetings I'm using VC++.NET to create a class library. The class library contains managed classes that wrap legacy unmanaged classes by the same name. I use regasm to register the DLL for...
3
by: Greg | last post by:
I seek to understand ATL better. When I create a Win32 Project (App or DLL) the option to add support for ATL (or MFC) is not selectable. It is only selectable for a Win32 Console App. However, it...
1
by: Ashutosh | last post by:
Hi, In VC++ 6.0, when we add a Registered ActiveX Control to the project form Project menu\Add to Project\Components and Contorls, then all the classes required for that control is automatically...
4
by: mailcsprasad | last post by:
When to use STL classes and when to use MFC Container classes?
5
by: Gianmaria Iaculo - RPC | last post by:
Hi, a simple question i think. I have some old projects written in C++ (VS6). I want to class and objects from this projects ( I have sources natually) in a C# application (win). Is it possible?...
7
by: Amu | last post by:
Hi i am stuck up in a part of project where i have to inherit the VC++ template classes into C#.net. Please provide me the solution for this .
2
by: Amu | last post by:
i have a dll ( template class) ready which is written in VC++6. But presently i need to inherit its classes into my new C#.net project.so if there is some better solution with u then please give me...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.