+ // want3D tells us whether or not the style specified a 3D border.
+ // If so, under WIN16 we can use Ctl3D to give it an appropriate style.
+ // Sometimes want3D is used to indicate that the non-extended style should have
+ // WS_BORDER.
+ bool want3D = TRUE;
+
+ // if no extended style given, determine it ourselves
+ if ( exstyle == (WXDWORD)-1 )
+ {
+ exstyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
+ }
+
+ // all controls should have these styles (wxWindows creates all controls
+ // visible by default)
+ style |= WS_CHILD | WS_VISIBLE;
+
+ int x = pos.x == -1 ? 0 : pos.x,
+ y = pos.y == -1 ? 0 : pos.y,
+ w = size.x == -1 ? 0 : size.x,
+ h = size.y == -1 ? 0 : size.y;
+
+ m_hWnd = (WXHWND)::CreateWindowEx
+ (
+ exstyle, // extended style
+ classname, // the kind of control to create
+ label, // the window name
+ style, // the window style
+ x, y, w, h, // the window position and size
+ GetHwndOf(GetParent()), // parent
+ (HMENU)GetId(), // child id
+ wxGetInstance(), // app instance
+ NULL // creation parameters
+ );
+
+ if ( !m_hWnd )
+ {
+ wxLogDebug(wxT("Failed to create a control of class '%s'"), classname);
+ wxFAIL_MSG(_T("something is very wrong"));
+
+ return FALSE;
+ }
+
+#if wxUSE_CTL3D
+ if ( want3D )
+ {
+ Ctl3dSubclassCtl(GetHwnd());
+ m_useCtl3D = TRUE;
+ }
+#endif // wxUSE_CTL3D