1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
BOOL WindowWrap::CreateWnd(LPCTSTR szCaption, HINSTANCE hInst, HICON hIcon, HMENU hMenu, BOOL bMinBox)
{
m_dwMainThreadID = GetCurrentThreadId();
m_hCursorArrow = LoadCursor(NULL, IDC_ARROW);
m_hCursorWait = LoadCursor(NULL, IDC_WAIT);
m_hCursorIbeam = LoadCursor(NULL, IDC_IBEAM);
m_hCursorSize = LoadCursor(NULL, IDC_SIZEALL);
m_hCursorCurrent = m_hCursorArrow;
m_hCursorHand = LoadCursor(NULL, IDC_HAND);
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wcex.lpfnWndProc = (WNDPROC)(m_Trunk.sfp4(&vEngine::WindowWrap::WndProc));;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInst;
wcex.hIcon = hIcon;
wcex.hCursor = m_hCursorCurrent;
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = 0;
wcex.lpszClassName = szCaption;
wcex.hIconSm = 0;// LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
if( 0 == RegisterClassEx(&wcex) )
{
OutputDebugString(_T("error register window class"));
return FALSE;
}
if (bMinBox)
m_hWnd = ::CreateWindow(szCaption, szCaption, WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, m_nWidth, m_nHeight, NULL, NULL, hInst, NULL); // <---- error there
else
m_hWnd = ::CreateWindow(szCaption, szCaption, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, m_nWidth, m_nHeight, NULL, NULL, hInst, NULL);
if( !m_hWnd )
{
OutputDebugString(_T("error creating window"));
return 1;
}
//... some other staff there
}
|