• Advertisement
Sign in to follow this  

CE GetDC() not a member of _HDC ?

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

So I got this really NICE nice document about fonts, read it and copy the codes to my CE app. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcefonts5/html/wce50condrawingandformattingtext.asp
void initiateText ()
{
  // Get a GDI DC onto the backbuffer, where you will render the text.
  g_lpDDSBack->GetDC (&hdcSurface);

  // Select the font into the DC.
  hfontSave = (HFONT) SelectObject (hdcSurface, hfontTimes);

  // Set the background mode to transparent, so there is no
  // rectangle behind the text.
  SetBkMode (hdcSurface, TRANSPARENT);
}

EVC++ compiler says there is no declaration for g_lpDDSBack, so I wrote
HDC g_lpDDSBack

THe compiler says
:\WSC4eVC\APPS\message.cpp(209) : error C2039: 'GetDC' : is not a member of 'HDC__'

        C:\Windows CE Tools\wce300\Pocket PC 2002\include\windef.h(254) : see declaration of 'HDC__'

I look up for GetDC() in msdn library and it didn't mention any special include files. What's up? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
So I found this site

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/html/_wcesdk_win32_getdc.asp

Windows CE OS 1.0 and later
Winuser.h
Coredll.lib, Winmgr.lib

Pump those stuff into my #includes and library settings but the same
error: not a member of _HDC.

Ah, I can't sleep today. What is the problem?

Share this post


Link to post
Share on other sites
g_lpDDSBack is a pointer to a DirectDraw surface - most likely the back buffer. The declaration for this would be:

IDirectDrawSurface * g_lpDDSBack;

You need to initialize the pointer with a call to IDirectDraw::CreateSurface before you attempt to get a DC from it.

Share this post


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

  • Advertisement