Windows XP Problems since updating from VS2005 to VS2008
-
Hallo, I upgraded from Visual Studio 2005 to Visual Studio 2008, and converted my Project from from VS2005 to VS2008. But now I get an Error in the following lines:
// Get the current font
LOGFONT lFont;
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS), &ncm, 0));
lFont = ncm.lfMessageFont;In Windows XP SystemParametersInfo() returns false, and there are the following Values in ncm after executing the SystemParametersInfo() Function: Screenshot When I open my Project in Windows 7, it works without problem. In XP I get an access exeption in msvcr90d.dll when I ignore the failed execution of SystemParametersInfo. Can someone help me? Thank you!
-
Hallo, I upgraded from Visual Studio 2005 to Visual Studio 2008, and converted my Project from from VS2005 to VS2008. But now I get an Error in the following lines:
// Get the current font
LOGFONT lFont;
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS), &ncm, 0));
lFont = ncm.lfMessageFont;In Windows XP SystemParametersInfo() returns false, and there are the following Values in ncm after executing the SystemParametersInfo() Function: Screenshot When I open my Project in Windows 7, it works without problem. In XP I get an access exeption in msvcr90d.dll when I ignore the failed execution of SystemParametersInfo. Can someone help me? Thank you!
I would guess NONCLIENTMETRICS has grown... And VS2008 will default WINVER to a later (higher) value, so the size you have compiled is the "bigger" one. You pass the size of the structure to SystemParametersInfo - and the later OS can handle the earlier structure. But the earlier OS can't handle the later structure. Doing a little digging... http://msdn.microsoft.com/en-us/library/ms724506%28VS.85%29.aspx[^]
typedef struct tagNONCLIENTMETRICS {
UINT cbSize;
int iBorderWidth;
...
LOGFONT lfMessageFont;
#if (WINVER >= 0x0600)
int iPaddedBorderWidth;
#endif
} NONCLIENTMETRICS, *LPNONCLIENTMETRICS;You can see my theory is probably right. XP has no idea what to do with the oversized structure you're giving it... If you want to be compatible with XP, define WINVER to an appropriate value (0x501 I thiiiink) before including the header files. Good luck, Iain.
I have now moved to Sweden for love (awwww).
-
I would guess NONCLIENTMETRICS has grown... And VS2008 will default WINVER to a later (higher) value, so the size you have compiled is the "bigger" one. You pass the size of the structure to SystemParametersInfo - and the later OS can handle the earlier structure. But the earlier OS can't handle the later structure. Doing a little digging... http://msdn.microsoft.com/en-us/library/ms724506%28VS.85%29.aspx[^]
typedef struct tagNONCLIENTMETRICS {
UINT cbSize;
int iBorderWidth;
...
LOGFONT lfMessageFont;
#if (WINVER >= 0x0600)
int iPaddedBorderWidth;
#endif
} NONCLIENTMETRICS, *LPNONCLIENTMETRICS;You can see my theory is probably right. XP has no idea what to do with the oversized structure you're giving it... If you want to be compatible with XP, define WINVER to an appropriate value (0x501 I thiiiink) before including the header files. Good luck, Iain.
I have now moved to Sweden for love (awwww).
Thank you, VS2008 sets WINVER to Windows Vista. I now set WINVER in the stdafx.h files of my DLLs to WinXP and now it works. This is the greatest forum in the world! :)
-
Thank you, VS2008 sets WINVER to Windows Vista. I now set WINVER in the stdafx.h files of my DLLs to WinXP and now it works. This is the greatest forum in the world! :)
Joschwenk666 wrote:
This is the greatest forum in the world!
This is just a tribute! (you're welcome, glad I helped) Iain.
I have now moved to Sweden for love (awwww).