]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/private/metrics.h
Add support for specifying child process cwd and env to wxExecute().
[wxWidgets.git] / include / wx / msw / private / metrics.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/private/metrics.h
3 // Purpose: various helper functions to retrieve system metrics
4 // Author: Vadim Zeitlin
5 // Created: 2008-09-05
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MSW_PRIVATE_METRICS_H_
12 #define _WX_MSW_PRIVATE_METRICS_H_
13
14 namespace wxMSWImpl
15 {
16
17 // return NONCLIENTMETRICS as retrieved by SystemParametersInfo()
18 //
19 // currently this is not cached as the values may change when system settings
20 // do and we don't react to this to invalidate the cache but it could be done
21 // in the future
22 //
23 // MT-safety: this function is only meant to be called from the main thread
24 inline const NONCLIENTMETRICS& GetNonClientMetrics()
25 {
26 static WinStruct<NONCLIENTMETRICS> nm;
27 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &nm, 0) )
28 {
29 #if WINVER >= 0x0600
30 // a new field has been added to NONCLIENTMETRICS under Vista, so
31 // the call to SystemParametersInfo() fails if we use the struct
32 // size incorporating this new value on an older system -- retry
33 // without it
34 nm.cbSize -= sizeof(int);
35 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &nm, 0) )
36 #endif // WINVER >= 0x0600
37 {
38 // maybe we should initialize the struct with some defaults?
39 wxLogLastError(wxT("SystemParametersInfo(SPI_GETNONCLIENTMETRICS)"));
40 }
41 }
42
43 return nm;
44 }
45
46 } // namespace wxMSWImpl
47
48 #endif // _WX_MSW_PRIVATE_METRICS_H_
49