Re: [Dev-C++] What's wrong with this code?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Carlos d. M. <cg...@wo...> - 2002-11-27 11:12:21
|
TCHAR is one character never a string. For a string use either TCHAR* or LPTSTR. (Pointing about an answer by Marc Heiliger) Answering to Jaap, it's not needed to give a menu, you can use NULL if you don't want have one. That's just the default code for a window app and it works, giving a window with nothing. The answer is that you are not initializing the cbSize field of the WNDCLASS structure, you must initialize it so when the program watches at it it can use the memory space needed. You must add this line: wndclass.cbSize = sizeof(WNDCLASS); Remember this, always you need to use an structure you have ALWAYS to fill a member of it which is the size of the structure with structure.sizeMember = sizeof(STRUCTURE); The structures never know what's its own size, so you must provide it with that member. The answer can be too in the line, but I'm almost sure it is defined in the header, however I say it: wndclass.lpfnWndProc = WndProc; This member of the struct defines which is the window's callback function, which must have been defined before, but it is not defined, at least in this file. Add at the begin of it the line LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); And some place after in the file write the function. LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); |