🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++.leda
Article #132

Visual C++ question

#132
From: Joel Castellanos
Date: Fri, 13 Oct 1995 14:21
32 lines
1168 bytes
This question is about using the MFC.

CMainWnd::CMainWnd(){
  Create(NULL, "XX", WS_OVERLAPPEDWENDOW, DefauldRect,NULL,NULL);
}
void CMainWnd::OnPaint()  {
  CPaintDC dc(this);
  dc.Rectangle(100,100,180,140);
}

The above program works just fine - then when I 
try to move the "Rectangle" statement to a function I cannot
get the function to recognize "CPaintDC" ie.:


CMainWnd::CMainWnd(){
  Create(NULL, "XX", WS_OVERLAPPEDWENDOW, DefauldRect,NULL,NULL);
}
void myRect(int x) {
   dc.Rectangle(x,x,x+80,x+40);
   return(0);
}
void CMainWnd::OnPaint()  {
  CPaintDC dc(this);
  myRect(100);
}

First I tryed declaring CPaintDC dc(this) outside of both functions
(making it global), but the compiler complains about this.
If you know how to do this, then please send me some advice.
Thanks
Joel  (joel@es.rice.edu)
Technical Details
Message-ID: <45lskd$cpa@larry.rice.edu>
Path: arc1-ca.pugleaf.net!es.rice.edu!joel

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!es.rice.edu!joel
From: joel@rice.edu (Joel Castellanos)
Newsgroups: comp.lang.c++.leda
Subject: Visual C++ question
Date: 13 Oct 1995 14:21:01 GMT
Organization: Rice University, Houston, Texas
Message-ID: <45lskd$cpa@larry.rice.edu>
NNTP-Posting-Host: moe.rice.edu
X-Newsreader: TIN [version 1.2 PL2]