Archived

This topic is now archived and is closed to further replies.

VC++ pDC->LineTo/MoveTo

This topic is 5981 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I was wondering if there was an alternative way to draw a line on the screen then with the MoveTo LineTo, Or is there an alternitave to using pDC-> because my compiler (microsoft Visual C++ 6.0) is giving me errors with the pDC-> part...........Please help! ----------------------------- -------Mitch Mulholland------ ----A.K.A.= TwisteR---------- -----------------------------

Share this post


Link to post
Share on other sites
the error i get is :
pDC undeclared identifier.


-----------------------------
-------Mitch Mulholland------
----A.K.A.= TwisteR----------
-----------------------------

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
is pDC a pointer to a HDC?
maybe you didn''t define it.

Share this post


Link to post
Share on other sites
The identifier you want to use has not been declared. pDC can be anything you want it to be until you''ve told the compiler just what exactly is a pDC. You have this with all things in C++. Ever try to use an int without declaring it somewhere?

You need to get a pointer to a DC and store it in an appropriately declared variable. Either declare it in an argument list, locally, or globally. You will still need to make sure that pDC points to a valid DC (try calling GetDC() with the window handle). Before letting the pointer variable go out of scope, be sure to call ReleaseDC().

Share this post


Link to post
Share on other sites
pDC specifically is the name that MFC uses in certain functions like OnDraw, etc., when the programmer would need a pointer to the device context. Maybe you are just using the variable when it isn''t passed through the funtion.

Share this post


Link to post
Share on other sites