So I finally decided to take on some Windows Programming, and everything is going fine, except this:

Edit: using this tutorial http://bobobobo.wordpress.com/2008/01/31/how-to-create-a-basic-window-in-c/

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	WNDCLASS myWindow;

	myWindow.cbClsExtra = 0;
	myWindow.cbWndExtra = 0;
	myWindow.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	myWindow.hCursor = LoadCursor(NULL, IDC_ARROW);
	myWindow.hIcon = NULL;
	myWindow.hInstance = hInstance;
	myWindow.lpfnWndProc = WndProc;
	myWindow.lpszClassName = TEXT("Levi");
	myWindow.lpszMenuName = 0;
	myWindow.style = CS_VREDRAW | CS_HREDRAW;

	RegisterClass(&myWindow);

	HWND myHandle = CreateWindow(TEXT("Levi"), TEXT("My Window"), WS_OVERLAPPEDWINDOW, 10, 10, 200, 200, NULL, NULL, hInstance, NULL);


	

}

error C2065: 'WndProc' : undeclared identifier

Every tutorial Ive found uses WndProc but its telling me other wise.

Any Ideas? Thanks

Edited 6 Years Ago by LevyDee: n/a

So I finally decided to take on some Windows Programming, and everything is going fine, except this:

Edit: using this tutorial http://bobobobo.wordpress.com/2008/01/31/how-to-create-a-basic-window-in-c/

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	WNDCLASS myWindow;

	myWindow.cbClsExtra = 0;
	myWindow.cbWndExtra = 0;
	myWindow.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	myWindow.hCursor = LoadCursor(NULL, IDC_ARROW);
	myWindow.hIcon = NULL;
	myWindow.hInstance = hInstance;
	myWindow.lpfnWndProc = WndProc;
	myWindow.lpszClassName = TEXT("Levi");
	myWindow.lpszMenuName = 0;
	myWindow.style = CS_VREDRAW | CS_HREDRAW;

	RegisterClass(&myWindow);

	HWND myHandle = CreateWindow(TEXT("Levi"), TEXT("My Window"), WS_OVERLAPPEDWINDOW, 10, 10, 200, 200, NULL, NULL, hInstance, NULL);


	

}

error C2065: 'WndProc' : undeclared identifier

Every tutorial Ive found uses WndProc but its telling me other wise.

Any Ideas? Thanks

You forgot the window procedure event handler

This may help....
cprogramming.com (Helps with c++ too)

declare WinProc function...
LRESULT CALLBACK WinProc(HWND hwnd.UINT msg,WPARAM wparam,LPARAM lparam);

This question has already been answered. Start a new discussion instead.