fix assert when using owner-drawn menu items with the newest (Vista) SDK [backport from trunk]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51379 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-01-26 01:38:06 +00:00
parent 1ca0f7a249
commit 57f27af169
2 changed files with 16 additions and 1 deletions

View File

@@ -127,6 +127,7 @@ wxMSW:
- Fix setting icons when they have non-default (16*16 and 32*32) sizes.
- Fixed wxLocale::GetInfo to use the C locale.
- Don't enable disabled windows when showing them (Harry McKame).
- Fix assert when using owner-drawn menu items with the newest (Vista) SDK
wxGTK:

View File

@@ -50,7 +50,21 @@ public:
#if defined(__WXMSW__) && defined(__WIN32__) && defined(SM_CXMENUCHECK)
NONCLIENTMETRICS nm;
nm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS,0,&nm,0);
if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,0,&nm,0) )
{
#if WINVER >= 0x0600
// a new field has been added to NONCLIENTMETRICS under Vista, so
// the call to SystemParametersInfo() fails if we use the struct
// size incorporating this new value on an older system -- retry
// without it
nm.cbSize -= sizeof(int);
if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &nm, 0) )
#endif // WINVER >= 0x0600
{
// maybe we should initialize the struct with some defaults?
wxLogLastError(_T("SystemParametersInfo(SPI_GETNONCLIENTMETRICS)"));
}
}
ms_systemMenuButtonWidth = nm.iMenuHeight;
ms_systemMenuHeight = nm.iMenuHeight;