help with creating window
Code:
#include <windows.h>
#define WndClsname[] "Justin's window class"
LRESULT CALLBACK WndProcedure( HWND hwnd, UNIT msg, WPARAM wParam, LPARAM lParam);
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
HWND hwnd;
WNDCLASSEX wc;
MSG msg;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_VREDRAW|CS_HREDRAW;
wc.lpfnWndProc = WndProcedure;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = WndClsname;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL, "Window Registration Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
hwnd = CreateWindowEx
(WS_EX_CLIENTEDGE,
WndClsname,
"The title of the window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
320,120,
NULL,NULL,hInstance, NULL
);
if(hwnd == NULL)
{
MessageBox(NULL, "Window Creation Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProcedure( HWND hwnd, UNIT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
break;
}
return 0;
}
i get errors concerning UNIT is undeclared,
invalid conversion from `LRESULT (*)(HWND__*, int, WPARAM, LPARAM)' to `LRESULT (*)(HWND__*, UINT, WPARAM, LPARAM)', and
expected primary-expression before ']' token
hey i have another problem
im using resource file to make a new cursor...
i used icon suite program for the visual editor, and script the rc file
in bloodshed(latest ver)
Code:
#include "resource.h"
IDC_REDCUR CURSOR "Red.cur"
This is the .rc script and the
header i just type in #define IDC_REDCUR 104 .
for the program i just modtify it with
wc.hCursor = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_REDCUR));
and the image is 16x16 256 color ...