strange error in vc

create a new mfc sdi project, in onDraw fuction add the following:
pDC->SetDCPenColor(RGB(0,0,0));

when compile, this error happens:
error C2039: 'SetDCPenColor' : is not a member of 'CDC'

according to msdn, CDC has this member. when i input these, there is even a auto completion.

how could this happen?

[332 byte] By [wrb302] at [2007-12-16]
# 1
If you look in the afxwin.h file you'll find that function under the following #ifdef:

#if (_WIN32_WINNT >= 0x0500)
...

COLORREF SetDCPenColor(COLORREF crColor);
#endif

The default MFC AppWizard Generated application defines _WIN32_WINNT to be 0x400 (in stdafx.h). To use this function, go to your stdafx.h file and change the #define from 0x400 to 0x500.

HTH,

Ron Pihlgren
VC++ Testing

RonPihlgren at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...
# 2
it works.

thank you so much

wrb302 at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ General...