WNDPROC and incorrect parameter error
Friends,
I am a newbie to Win32 programming and I am mucking around with a silly
issue due to my lackness in win32 knowledge. Basically, I am trying to
create a child window inside an main window. The main window gets created
properly, in the main windows WM_CREATE message I am calling a method which
creates a child window, here is what my WNDPROC for main window looks like,
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
switch (message)
{
case WM_CREATE:
CreateChildWindow ( hWnd, WndProc3, _T("helper_clas") );
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
In the CreateChildWindow function I am creating a child window,
VOID CreateChildWindow ( HWND hWnd, WNDPROC wndProc, LPCWSTR className )
{
WNDCLASSEX wcx ={0};
HWND hChild;
wcx.cbSize = sizeof(WNDCLASSEX);
wcx.lpszClassName = className;
wcx.hInstance = hInst;
wcx.lpfnWndProc = wndProc;
wcx.hbrBackground = (HBRUSH)::GetStockObject(GRAY_BRUSH);
wcx.hCursor = LoadCursor(NULL, IDC_ARROW);
wcx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcx.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wcx);
hChild = CreateWindowEx(0L, className, NULL, WS_VISIBLE | WS_CHILD
, 45,0,200,300, hWnd, NULL, NULL, NULL);
if ( hChild == NULL )
MessageBox ( hWnd, _T( "No luck" ), _T("E"), MB_OK );
}
Window not gets created and the GetLastError shows something like the
parameter is incorrect (error number: 87). I am not sure what parameter went
wrong over here. Please help me.
Thanks,
Vadi