diff --git a/include/wx/msw/private/metrics.h b/include/wx/msw/private/metrics.h index 10c3b41c35..4516bd1485 100644 --- a/include/wx/msw/private/metrics.h +++ b/include/wx/msw/private/metrics.h @@ -22,10 +22,14 @@ namespace wxMSWImpl // in the future // // MT-safety: this function is only meant to be called from the main thread -inline const NONCLIENTMETRICS& GetNonClientMetrics(const wxWindow* win) +inline const NONCLIENTMETRICS GetNonClientMetrics(const wxWindow* win) { - static WinStruct nm; - if ( !wxSystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &nm, 0 , win) ) + WinStruct nm; + if ( !wxSystemParametersInfo(SPI_GETNONCLIENTMETRICS, + sizeof(NONCLIENTMETRICS), + &nm, + 0, + win) ) { #if WINVER >= 0x0600 // a new field has been added to NONCLIENTMETRICS under Vista, so @@ -33,7 +37,11 @@ inline const NONCLIENTMETRICS& GetNonClientMetrics(const wxWindow* win) // size incorporating this new value on an older system -- retry // without it nm.cbSize -= sizeof(int); - if ( !wxSystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &nm, 0, win) ) + if ( !wxSystemParametersInfo(SPI_GETNONCLIENTMETRICS, + sizeof(NONCLIENTMETRICS), + &nm, + 0, + win) ) #endif // WINVER >= 0x0600 { // maybe we should initialize the struct with some defaults?