I hate how tempremental this **** can be... I just wrote this, I thoght it would work no problem... but for some dumbass reason it says "FAILED TO CREATE WINDOW", in otherwords hwnd == NULL.
SPHCode:#include <windows.h> bool jah = true; HWND hwnd; LRESULT CALLBACK wndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_CLOSE: DestroyWindow(hwnd); jah = false; return 0; default:return 0; } return DefWindowProc(hwnd, Message, wParam, lParam); } int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) { MSG * msg = new MSG; WNDCLASSEX wnd; ZeroMemory((void*)&wnd,sizeof(WNDCLASSEX)); wnd.cbSize = sizeof(WNDCLASSEX); wnd.hbrBackground = (HBRUSH)(COLOR_WINDOW); wnd.hIcon = LoadIcon(NULL, IDI_APPLICATION); wnd.hCursor = LoadCursor(NULL, IDC_ARROW); wnd.hIconSm = wnd.hIcon; wnd.hInstance = hInstance; wnd.lpfnWndProc = wndProc; wnd.lpszClassName = "listcontroltest"; if(!RegisterClassEx(&wnd)) { MessageBox(NULL,"FAILED TO REGISTER CLASS","ERROR",MB_ICONERROR); return 0; } hwnd = CreateWindowEx(WS_SYSMENU,"listcontroltest","Hello",WS_SYSMENU,0,0,100,100,NULL,(HMENU)NULL,hInstance,NULL); if(!hwnd) { MessageBox(NULL,"FAILED TO CREATE WINDOW","ERROR",MB_ICONERROR); return 0; } ShowWindow(hwnd,nCmdShow); UpdateWindow(hwnd); while(jah) { PeekMessage(msg,NULL,0,0,PM_REMOVE); TranslateMessage(msg); DispatchMessage(msg); } return 1; }![]()



LinkBack URL
About LinkBacks



