Code:
#include <windows.h>
LRESULT CALLBACK WndProc ( HWND, UINT, WPARAM, LPARAM );
HINSTANCE hInstGlobal;
int APIENTRY WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
hInstGlobal = hInstance;
WNDCLASS wc;
wc.style = 0;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.lpszMenuName = 0;
wc.lpszClassName = "Dog Simulator 2";
RegisterClass (&wc);
HWND hWindow;
hWindow = CreateWindow ( "Kazalio Studios", "Dog Simulator 2",
WS_OVERLAPPEDWINDOW,
0, 0, 600, 460, NULL, NULL,
hInstance, NULL );
ShowWindow(hWindow, nCmdShow);
UpdateWindow(hWindow);
MSG Message;
while (GetMessage(&Message, NULL, 0, 0))
{
TranslateMessage (&Message);
DispatchMessage (&Message);
}
return (Message.wParam);
}
void begin(HWND hWnd)
{
HDC hDC;
PAINTSTRUCT Ps;
HFONT font;
hDC = BeginPaint(hWnd, &Ps);
font = CreateFont(46, 28, 215, 0,
FW_NORMAL, FALSE, FALSE, FALSE,
ANSI_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_ROMAN,
"Times New Roman");
SelectObject(hDC, font);
TextOut(hDC, 20, 128, "Euzhan Palcy", 12);
DeleteObject(font);
EndPaint(hWnd, &Ps);
}
LRESULT CALLBACK WndProc ( HWND hWnd, UINT uiMessage,
WPARAM wParam, LPARAM lParam )
{
switch (uiMessage)
{
case WM_CREATE:
HWND hBegin, hExit;
hBegin = CreateWindow ("BUTTON", "Continue", //error
WS_CHILD|WS_VISIBLE,
BS_PUSHBUTTON,
10, 340, 140, 20,
hWnd, (HMENU) 1,
hInstGlobal, NULL);
hExit = CreateWindow ("BUTTON", "Exit",
WS_CHILD|WS_VISIBLE|
BS_PUSHBUTTON,
360, 340, 140, 20,
hWnd, (HMENU), 2,
hInstGlobal, NULL);
return 0;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
if (LOWORD(wParam) == 1)
{
begin(HWND hWnd);
}
if (LOWORD(wParam) == 2)
{
SendMessage (GetParent((HWND) lParam),
WM_DESTROY, 0, 0);
}
}
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc (hWnd, uiMessage,
wParam, lParam);
}
}
It comes up with the error