chris95219
December 2nd, 2006, 09:16 PM
Okay, this has been bugging me for the past week or so.. i've been trying everything i can to find the bug.. but.. no luck. My GUI just won't show up. I checked the value of the hWnd and it is showing up as null.. so the CreateWindowEx() function isn't working for me.
Anyone care to take a look? Greatly appreciated!!!!!!
Window(WNDPROC WndProc, char* sTitle, int nX, int nY) {
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = TEXT(sTitle);
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wc);
this->hWnd = ::CreateWindowEx(WS_EX_CLIENTEDGE, TEXT(sTitle), sTitle, WS_OVERLAPPEDWINDOW, nX, nY, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), NULL);
::ShowWindow(hWnd, SW_SHOW);
::UpdateWindow(hWnd);
}
i have a window class and that is the constructor.
and here is how im trying to use it:
MSG msg;
Window * myWindow = new Window(MyFunc, "test", 0, 0);
and i do have a while loop to keep it running.
Anyone care to take a look? Greatly appreciated!!!!!!
Window(WNDPROC WndProc, char* sTitle, int nX, int nY) {
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = TEXT(sTitle);
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wc);
this->hWnd = ::CreateWindowEx(WS_EX_CLIENTEDGE, TEXT(sTitle), sTitle, WS_OVERLAPPEDWINDOW, nX, nY, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), NULL);
::ShowWindow(hWnd, SW_SHOW);
::UpdateWindow(hWnd);
}
i have a window class and that is the constructor.
and here is how im trying to use it:
MSG msg;
Window * myWindow = new Window(MyFunc, "test", 0, 0);
and i do have a while loop to keep it running.