• Advertisement
Sign in to follow this  

Error I cant resolve

This topic is 4886 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 there, I was wondering if anyone could help me with an error I have in my code. I'm working from the book 'Tricks of Windows Game Programming Gurus' and on chapter 4...drawing lines. This is the code giving me the trouble... HPEN green_pen = CreatePen(PS_SOLID, 1, RGB(255,255,255)); HPEN old_pen = SelectObject(hdc, green_pen); MoveToEx(hdc, 10,10,NULL); LineTo(hdc,160,60); SelectObject(hdc,old_pen); DeleteObject(green_pen); And this is the error... error C2440: 'initializing' : cannot convert from 'void *' to 'struct HPEN__ *' Any help greatly appreciated, Many Thanks, David

Share this post


Link to post
Share on other sites
Advertisement
You don't say what line the error is on. I assume it's the second line. Try:

HPEN old_pen = (HPEN) SelectObject(hdc, green_pen);

Skizz

Share this post


Link to post
Share on other sites
Thanks very much Skizz. You were right, the error was on the 2nd line, well spotted!

The program is now working...I drew my first line! Yehh!

Cheers,

David

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement