Click here to Skip to main content
15,889,909 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: database connection Pin
_AnsHUMAN_ 31-Jan-06 17:02
_AnsHUMAN_ 31-Jan-06 17:02 
AnswerRe: database connection Pin
dli_9802-Feb-06 10:08
dli_9802-Feb-06 10:08 
QuestionAbout interface Pin
dli_98031-Jan-06 13:26
dli_98031-Jan-06 13:26 
AnswerRe: About interface Pin
Ryan Binns31-Jan-06 17:15
Ryan Binns31-Jan-06 17:15 
Questionstatusbar - caps lock,num lock, scroll lock Pin
locoone31-Jan-06 13:19
locoone31-Jan-06 13:19 
AnswerRe: statusbar - caps lock,num lock, scroll lock Pin
Ryan Binns31-Jan-06 17:19
Ryan Binns31-Jan-06 17:19 
GeneralRe: statusbar - caps lock,num lock, scroll lock Pin
locoone1-Feb-06 8:15
locoone1-Feb-06 8:15 
QuestionBugs Porting MFC6 to MFC8 Pin
J Yates31-Jan-06 11:28
J Yates31-Jan-06 11:28 
I am currently porting an MFC app from VC++ 6.0 to
VS 2005 (MFC8). So far I have noted the following MFC8 bugs.

01) AfxIsValidAddress

No longer properly validates the memory block:

In MFC6: (OK)

BOOL AFXAPI AfxIsValidAddress(const void* lp, UINT nBytes,
BOOL bReadWrite /* = TRUE */)
{
// simple version using Win-32 APIs for pointer validation.
return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
(!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));
}

In MFC8: (bad)

BOOL AFXAPI AfxIsValidAddress(const void* p, UINT_PTR nBytes,
BOOL bReadWrite /* = TRUE */)
{
return ATL::AtlIsValidAddress(p, nBytes, bReadWrite);
}

// Verify that a pointer points to valid memory
inline BOOL AtlIsValidAddress(const void* p, size_t nBytes,
BOOL bReadWrite = TRUE)
{
(bReadWrite);
(nBytes);
return (p != NULL);
}

02) CFont::CreatePointFontIndirect

Calculates the font lfHeight incorrectly. In MFC6 it used simple division
to convert nPointSize to LOGFONT::lfHeight. In MFC8 it uses ::MulDiv which
rounds the result giving a different font size.

In MFC6: (OK)

BOOL CFont::CreatePointFontIndirect(const LOGFONT* lpLogFont, CDC* pDC)
{
....
pt.y = ::GetDeviceCaps(hDC, LOGPIXELSY), logFont.lfHeight;
pt.y /= 720; // truncates

In MFC8: (bad)

BOOL CFont::CreatePointFontIndirect(const LOGFONT* lpLogFont, CDC* pDC)
{
....
pt.y = ::MulDiv(::GetDeviceCaps(hDC, LOGPIXELSY), logFont.lfHeight, 720); // rounds


J. Yates

-- modified at 18:48 Tuesday 31st January, 2006
AnswerRe: Bugs Porting MFC6 to MFC8 Pin
Jack Puppy31-Jan-06 13:53
Jack Puppy31-Jan-06 13:53 
AnswerRe: Bugs Porting MFC6 to MFC8 Pin
Ryan Binns31-Jan-06 17:25
Ryan Binns31-Jan-06 17:25 
GeneralRe: Bugs Porting MFC6 to MFC8 Pin
J Yates1-Feb-06 5:15
J Yates1-Feb-06 5:15 
GeneralRe: Bugs Porting MFC6 to MFC8 Pin
Ryan Binns1-Feb-06 12:24
Ryan Binns1-Feb-06 12:24 
GeneralRe: Bugs Porting MFC6 to MFC8 Pin
J Yates1-Feb-06 13:27
J Yates1-Feb-06 13:27 
QuestionTab Controls Pin
BuckBrown31-Jan-06 11:23
BuckBrown31-Jan-06 11:23 
AnswerRe: Tab Controls Pin
Stephen Hewitt31-Jan-06 11:47
Stephen Hewitt31-Jan-06 11:47 
GeneralRe: Tab Controls Pin
_anil_31-Jan-06 17:28
_anil_31-Jan-06 17:28 
GeneralRe: Tab Controls Pin
Stephen Hewitt31-Jan-06 17:30
Stephen Hewitt31-Jan-06 17:30 
GeneralRe: Tab Controls Pin
_anil_31-Jan-06 18:41
_anil_31-Jan-06 18:41 
GeneralRe: Tab Controls Pin
Stephen Hewitt31-Jan-06 18:44
Stephen Hewitt31-Jan-06 18:44 
AnswerRe: Tab Controls Pin
Owner drawn31-Jan-06 17:29
Owner drawn31-Jan-06 17:29 
QuestionProblems with VariantChangeType and VT_BOOL in CE Pin
Paul M Watt31-Jan-06 10:55
mentorPaul M Watt31-Jan-06 10:55 
Questiondevice manager refresh Pin
Manu_8131-Jan-06 9:36
Manu_8131-Jan-06 9:36 
AnswerRe: device manager refresh Pin
Blake Miller31-Jan-06 10:29
Blake Miller31-Jan-06 10:29 
GeneralRe: device manager refresh Pin
Manu_8131-Jan-06 11:45
Manu_8131-Jan-06 11:45 
GeneralRe: device manager refresh Pin
Ryan Binns31-Jan-06 17:28
Ryan Binns31-Jan-06 17:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.