#include
#include
#include
using namespace std;
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
WNDCLASSEX wcex;
HWND hWnd;
HINSTANCE hInstance;
MSG msg;
BOOL quit = FALSE;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WinProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = GetStockBrush(WHITE_BRUSH);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = "MyWndClassEx"
wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);;
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char * cmdParam, int cndShow)
{
RegisterClassEx(&wcex);
hwnd = CreateWindowEx(0,
"MyWndClassEx",
"Hello World!",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
500,
500,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hwnd, nCmdShow);
while (quit != TRUE)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if (msg.message == WM_QUIT)
{
quit = TRUE;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
My MinGW compiler on Code::Blocks prevents me compiling the wcex WinClassEx because of "expected constructor, destructor, or type conversion before '-' token."
Also, can someone recommend me a good WinAPI tutorial that can teach me to create text areas and buttons? I want to create a simple add/sub calculator.
Thanks.
- Thsotus