HWND MakeLayOutWnd ( HWND hwndParent, HWND hwndClient, HINSTANCE
hInstance )
{
char szLayOut[] = "LayOut"; // Layout child window name
WNDCLASSEX Drawwc; // Drawing window structure
HWND hwndLayOut; // This is a child window.
Drawwc.cbSize = sizeof (Drawwc) ;
Drawwc.style = 0;
Drawwc.lpfnWndProc = DrawProc; // Function to retrieve messages for
// windows of this class.
Drawwc.cbClsExtra = 0;
Drawwc.cbWndExtra = 0; // No per-window extra data.
Drawwc.hInstance = hInstance;
Drawwc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
Drawwc.hCursor = LoadCursor(NULL, IDC_ARROW);
Drawwc.hbrBackground = (HBRUSH) GetStockObject (GRAY_BRUSH) ;
Drawwc.lpszMenuName = (LPCTSTR) NULL; //Name of menu resource in
.RC file.
// The (LPCTSTR) insures that this parameter has the correct #
of bytes. ??
Drawwc.lpszClassName = szLayOut; // Name used in call to
CreateWindow.
Drawwc.hIconSm = LoadIcon (NULL,IDI_APPLICATION) ;
/* Register the view child window class and return success/failure
code. */
if(!RegisterClassEx (&Drawwc))
return FALSE;
if(!hwndLayOut = CreateWindowEx(WS_EX_MDICHILD, szLayOut, "LayOut",
WS_CHILD,
CW_USEDEFAULT,0,CW_USEDEFAULT,0, hwndClient,
(HMENU) NULL,
hInstance,
(LPSTR) NULL));
{
MessageBox(hwndClient, "Unable to open child window !", NULL,
MB_ICONEXCLAMATION | MB_OK);
return NULL ;
}
ShowWindow(hwndLayOut,SW_SHOW) ;
What symptoms does your program have that make you think something is
wrong?
The only problem that I see is a semicolon (;) after the if statement
containing the CreateWindowEX() function. This terminates the if
statement and causes the MessageBox() and return statements to be
executed unconditionally.
Norm