+ // although we already call InitCommonControls() in app.cpp which is
+ // supposed to initialize all common controls, in comctl32.dll 4.72 (and
+ // presumably earlier versions 4.70 and 4.71, date time picker not being
+ // supported in < 4.70 anyhow) it does not do it and we have to initialize
+ // it explicitly
+ static bool s_initDone = false; // MT-ok: used from GUI thread only
+ if ( !s_initDone )
+ {
+ if ( wxApp::GetComCtl32Version() < 470 )
+ {
+ wxLogError(_("This system doesn't support date picker control, please upgrade your version of comctl32.dll"));
+
+ return false;
+ }
+
+ INITCOMMONCONTROLSEX icex;
+ icex.dwSize = sizeof(icex);
+ icex.dwICC = ICC_DATE_CLASSES;
+
+ wxDynamicLibrary dllComCtl32(_T("comctl32.dll"), wxDL_VERBATIM);
+
+ typedef BOOL (WINAPI *ICCEx_t)(INITCOMMONCONTROLSEX *);
+ wxDYNLIB_FUNCTION( ICCEx_t, InitCommonControlsEx, dllComCtl32 );
+
+ if ( pfnInitCommonControlsEx )
+ {
+ (*pfnInitCommonControlsEx)(&icex);
+ }
+
+ s_initDone = true;
+ }
+
+
+ // use wxDP_SPIN if wxDP_DEFAULT (0) was given as style
+ if ( !(style & wxDP_DROPDOWN) )
+ style |= wxDP_SPIN;
+