CE GetDC() not a member of _HDC ?

Started by
2 comments, last by CRAZY COCONUT COW 17 years, 6 months ago
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.
MoooooooooooMoooooooooooooooooooMoooooooooooooooooooooooooooooooooo
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?
MoooooooooooMoooooooooooooooooooMoooooooooooooooooooooooooooooooooo
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.

Thanks muah!
MoooooooooooMoooooooooooooooooooMoooooooooooooooooooooooooooooooooo

This topic is closed to new replies.

Advertisement