Sign in to follow this  

getdc() GDI query PART 2

This topic is 4729 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

I'm trying to draw a rectangle in my game_main function, but I get the following error - error C2065: 'Getdc' : undeclared identifier It works in the pre-written examples I have, but in these it isn't used in a function so presumably I have to do something to have it recognised inside the game_main??? This is the game_main -
int Game_Main(void *parms = NULL, int num_parms = 0)
{

// Test if user is hitting ESC and send WM_CLOSE
if (KEYDOWN(VK_ESCAPE))
   SendMessage(main_window_handle,WM_CLOSE,0,0);

// Draw rectangle
HWND hwnd;
//get DC
HDC hdc = Getdc(hwnd);
// create pen and brush
HPEN blue_pen = createpen(PS_SOLID, 1, RGB(0,0,255));
HBRUSH red_brush = createsolidbrush(RGB(255,0,0));
// select pen and brush into context
selectobject(blue_pen);
selectobject(red_brush);
// draw rectangle
rectangle(hdc, 10,10, 20,20);

// return code
return(1);

} // end Game_Main

Share this post


Link to post
Share on other sites

This topic is 4729 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this