I get the followin error while trying to compile a program that creates an EDIT box at runtime:
--------------------Configuration: TextPad - Win32 Debug--------------------
Compiling...
Main.cpp
C:\Documents and Settings\Gustavo1\Desktop\henrique\TextPad\Main.cpp(82) : error C2440: '=' : cannot convert from 'void *' to 'struct HFONT__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
Error executing cl.exe.
TextPad.exe - 1 error(s), 0 warning(s)
-------------------------------------------------------------------------------
This is the part where my errorr is supposed to be at...I have also included the #define which is at the beginning of the program
Thanks.Code:#define IDC_MAIN_EDIT 101 LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CREATE: HFONT hfDefault; HWND hEdit; hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL, 0, 0, 100, 100, hwnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL); if(hEdit == NULL) MessageBox(hwnd, "Could not create edit box.", "Error", MB_OK | MB_ICONERROR); hfDefault = GetStockObject(DEFAULT_GUI_FONT); SendMessage(hEdit, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0)); case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; }




Reply With Quote