EvilZone
Programming and Scripting => C - C++ => : Pachelbel May 01, 2012, 09:38:43 PM
-
Hello I'm Pachelbel, first of all i wanna say that iam a Newb but i wont be crying like many other people that i saw in this posts. I started learning C++, and i wanted to go for Win32 Api.... now there is a problem and i need your help... i was writting this basic Win32 code and when i try to compile it i get this error: ('WindowProcedure' was not declared in this scope) --- line 11. Here is the code:
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow)
{
HWND hWnd;
MSG Message;
WNDCLASS WndClass;
WndClass.style = CS_HREDRAW | CS_VREDRAW;
WndClass.lpfnWndProc = WindowProcedure;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hInstance = hInstance;
WndClass.lpszClassName = "NUESTRA_CLASE";
WndClass.lpszMenuName = NULL;
RegisterClass(&WndClass);
hWnd = CreateWindow(
"NUESTRA_CLASE",
"Ventana de Ejemplo",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
320,
200,
HWND_DESKTOP,
NULL,
hInstance,
NULL
);
ShowWindow(hWnd, SW_SHOWDEFAULT);
while(TRUE == GetMessage(&Message, 0, 0, 0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}
What should i correct ???. Anyways thanks and sorry for my english, it isnt my mother tonge :P . Win32 API's Tutorials would be really helpfull!
-
What should i correct (http://evilzone.org/Smileys/default/huh.gif)
You have to declare WindowProcedure. I don't know where you got this from or what you think WindowProcedure shall do for you. But you are the only one who can tell what this shall be in oder to declare and implement it properly.
-
So what you are trying to say is that i need to declare it like a prototype under the library????
-
Something like is done here: http://www.infernodevelopment.com/c-win32-api-tutorial
-
I wasn´t looking at that website, but this will really help... found what i needed , Thank you very much Deque! :)