Why won't the window display?

while(GetMessage()){ TranslateMessage(); DispatchMessage();}
That's just some quicky psuedocode so check the documentation.
Also, why did you comment out ShowWindow() and UpdateWindow()?
And, you should at least call DefWindowProc() in the WinProc procedure. This handles messages you don't.
And you can probably leave out main_window_handle and just use your hwnd var wherever you use it.
Good Luck
Oh well. Ignore the previous post
All I am doing is createing a basic window class, registering it and trying to display it. I get no complie errors, but when I run the .exe nothing happens...Why not, what am I missing?
----------------------------------- //winmain entry point //declaration of window class //register wndclass hwnd = main_window_handle; //show window } ---------------------------------------
//includes and defines
#define WIN32_LEAN_AND_MEAN
#include
#include
//windproc function
LRESULT CALLBACK WindowProc(HWND hwnd, //the window
UINT msg, //the message itself
WPARAM wParam,
LPARAM lParam)
{
return 0;
}
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpCmdLine,
int nShowCmd)
{
WNDCLASS wndclass;
HWND hwnd;
wndclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WindowProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hinstance; //from winmain
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "WINCLASS1";
if (RegisterClass(&wndclass)==0)
{
//error
}
//create windows
HWND main_window_handle = NULL;
main_window_handle = CreateWindow("WINCLASS1",
"Blind Try",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100,
320, 200,
NULL,
NULL,
hinstance,
NULL);
//ShowWindow(main_window_handle, SW_SHOW);
//UpdateWindow(main_window_handle);
return 0;