Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Visual C++ graphics in SDI application

Status
Not open for further replies.

nhungr

Programmer
Jan 31, 2005
26
CA
I’m having problems trying to draw simple graphics (using the CDC::Ellipse function) in my SDI application. My program consists of the following classes :

class CMainFrame : public CframeWnd
class CChildView : public CWnd
class CVDANApp : public CWinApp

I also have a menu resource. I need a circle to be drawn in the ChildView window when the user clicks on a specific item (called “Run”) in the menu resource, as shown in the following code:

void CVDANApp::OnRun()
{
CWnd* pThisWnd = CChildView::GetActiveWindow();
drawmycircle(pThisWnd);
}

My problem is that I don’t know how to define a CWnd pointer to the CChildView class so that I can create a CPaintDC device context in the global drawmycircle function. I think my problem is that the GetActiveWindow() function points to the CMainFrame class instead of the CChildView class. How do I make it point to the child frame?

Any hints would be extremely helpful. Thanks…
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top