BOOL NativeWindow::Create(HWND hwndParent, LPCTSTR pstrName, DWORD dwStyle, DWORD dwExStyle, int x /* = CW_USEDEFAULT */, int y /* = CW_USEDEFAULT */, int cx /* = CW_USEDEFAULT */, int cy /* = CW_USEDEFAULT */, HMENU hMenu /* = NULL */) { BOOL created = FALSE; if (GetSuperClassName() != NULL) { if (!RegisterSuperClass()) { return FALSE; } } else { if(!RegisterWindowClass()) { return FALSE; } } hwnd_ = ::CreateWindowEx(dwExStyle, GetWindowClassName(), pstrName, dwStyle, x, y, cx, cy, hwndParent, hMenu, NULL, this); if (hwnd_ != NULL) { created = AfterCreated(); } return created; }
HWND WindowWnd::Create(HWND hWndParent, LPCTSTR pstrName, DWORD dwStyple, DWORD dwExStyle, int x /*= CW_USEDEFAULT*/, int y /*= CW_USEDEFAULT*/, int cx /*= CW_USEDEFAULT*/, int cy /*= CW_USEDEFAULT*/, HMENU hMenu /*= NULL*/) { try { if( GetSuperClassName() != nullptr ) RegisterSuperClass(); //如果SuperClassName存在的话就创建SuperClass else RegisterWindowClass(); m_hWnd = CreateWindowEx( dwExStyle, GetWindowClassName(), pstrName, dwStyple, x, y, cx, cy, hWndParent, hMenu, SystemInfo::GetInstance()->GetProcessInstance(),this); assert( m_hWnd != NULL ); return m_hWnd; } catch( ... ) { throw; } }