Hey. I just started working on some windows api programs, really basic stuff. Well, I have winProc and winMain and everything runs fine, but when I run it, the window I created does not show up. Here is the code I used:

#include <windows.h>

HWND hWnd;

LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
};

return DefWindowProc(hWnd, msg, wParam, lParam);
};


int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASSEX wcx;
MSG msg;

wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hbrBackground = (HBRUSH)(GetStockObject(BLACK_BRUSH));
wcx.hIcon = LoadCursor(NULL, IDC_ARROW);
wcx.hInstance = hInstance;
wcx.lpszClassName = "Learning";
wcx.lpfnWndProc = WindowProc;
wcx.lpszMenuName = 0;

RegisterClassEx(&wcx);

hWnd = CreateWindowEx(WS_EX_LEFT, "Learning", "Learning", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);

ShowWindow(hWnd, nShowCmd);

while(GetMessage(&msg, hWnd, NULL, NULL))
{
DispatchMessage(&msg);
};

return 0;
};



So I don't know why it doesn't work, it just doesn't. The window doesn't show up but it runs in the background and I have to ctrl-alt-del to kill it. Thanks in advance.

Toraton