View Full Version : what to do to get the pointer of CView?

03-11-2003, 07:26 PM
I build a project based SDI .In CMyView I use openGL to draw and render my 3D objects,then I create a dialog class based CDialog in order to control openGL of CMyView,but how to get the pointer of CView or CMyView?I use "CView* pView" in dialog class,but I fail to control openGL of CMyView.help me,please...

03-11-2003, 11:06 PM
Try asking in an MFC forum.

03-14-2003, 03:33 AM
You have to put the following in the file that contains your CDialog code:

CMyMainFrame* pFrame = (CMyMainFrame*) AfxGetMainWnd();
CMyView* pView = (CMyView*) pFrame->GetActiveView();

Now you have the correct pointer to your view object.

Aditionally you have to include headers of CMyMainFrame and CMyView classes.

[This message has been edited by Przemek (edited 03-14-2003).]

03-14-2003, 06:17 AM
Oh yeah, and feel free to ask any other MFC questions here.
Now let's talk about Iraq...

03-14-2003, 12:22 PM
Yes Knackered, your reply was indeed REALLY informative. <irony on> Keep up the good work! <irony off> Now, what is it that you'd like to learn about Iraq? Maybe I can be of any help, eh?

03-14-2003, 04:13 PM
This is an "advanced OpenGL" forum but then again I guess some guys will ask for a steak in a greengrocery too...

03-14-2003, 10:12 PM
Originally posted by Przemek:
Yes Knackered, your reply was indeed REALLY informative.

Actually I thought his reply was better than yours.

It was certainly more suitable given the forum.

Well done knackered... http://www.opengl.org/discussion_boards/ubb/biggrin.gif

<sarcasm on> I really like it when people post OT questions to the Advanced Opengl forum.<sarcasm off>

03-15-2003, 01:10 AM
Przemek, you have obviously never experienced a proliferation of off-topic posts in a forum before... it completely destroys the forum, and people interested/experienced in the actual topic stop frequenting said forums because they can't see the wood for the trees, so to speak. It happens, believe me.
Think before you speak next time, Przemek.

03-15-2003, 03:57 AM
I know what you talk about. But the only thing I wanted to achieve was to help opengllover. I belive my post did it. All next posts are completelly off topic and I can do nothing with it. Anyway in the future I'll be more carefull with answering questions which are off topic, just to avoid this kind of disscusion.
P.S. This was my first post on this forum, and I was happy that I could help somebody.

03-15-2003, 04:22 AM
In the future go to

and try googling for the right forum.
There are 10000 of them.