back again with another question.
i created a simple window in WIN32 mode, but it's giving me a linker error that i cannot isolate.
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
//defined this for all processes
HINSTANCE hInstance;
LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, LPARAM lParam, WPARAM wParam); //WndProc Prototype. always use this
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASSEX wc; //identifiers for the window
ZeroMemory(&wc,sizeof(WNDCLASSEX)); //
wc.cbClsExtra= NULL; //additional paramiters
wc.cbSize= sizeof(WNDCLASSEX); //size of the window class
wc.cbWndExtra= NULL; //aditional window paramiters
wc.hbrBackground= (HBRUSH)COLOR_WINDOW; //background color of the window
wc.hCursor= LoadCursor(NULL,IDC_ARROW); //window cursor
wc.hIcon= NULL; //window icon
wc.hIconSm= NULL; //small window icon
wc.hInstance= hInstance; //application instance
wc.lpfnWndProc= ( WNDPROC)WinProc; //callback proc.
wc.lpszClassName= _T("Window Class"); //class name
wc.lpszMenuName= NULL; //menu name
wc.style= CS_HREDRAW|CS_VREDRAW; //window styles
RegisterClassEx(&wc); //register the class
if(!RegisterClassEx(&wc))
{
MessageBox(NULL, _T("Classs registration failure error!"), _T("Execution Runtime Error"), MB_OK | MB_ICONEXCLAMATION);
return 1;
}
HWND hWnd = CreateWindowEx(NULL, _T("Window Class"), _T("Program Name"), WS_OVERLAPPEDWINDOW, 200, 200, 640, 480, NULL, NULL, hInstance, NULL); //create the window
if(!hWnd)
{
int nResult=GetLastError();
MessageBox(NULL, _T("Window creation failed"), _T("Window Creation Failed"), MB_OK | MB_ICONEXCLAMATION);
return 1;
}
ShowWindow(hWnd,nShowCmd); // show the window
UpdateWindow(hWnd); //update the window
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg); //translate message data
DispatchMessage(&msg); //throw a dispatch call to WinProc
}
return (int) msg.wParam;
}
//
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for the main window.
//
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
TCHAR greeting[] = _T("Does this work now?");
switch (msg)
{
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// Here the application is laid out.
TextOut(hdc,
5, 5,
greeting, _tcslen(greeting));
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
break;
}
return 0;
}
error:
lNK2019: unresolved external symbol "long __stdcall WinProc(struct HWND__ *,unsigned int,long,unsigned int)"
any ideas? i probably missed something somewhere, but idk. :/