Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends

I have created a MDI form in that i have 2 forms (treeview form and information form)
in 2nd (information form)
i have added 2 buttons next and previous

minimize, maximize works on all of client form correctly(before any click on 2nd form)


Problem:
when i click button on the info form or click the info form and maximize my application
my client window do not change its size


in client form 2 wndproc (also i have changed form 2 size in mainwindow wndproc)

C++
case WM_CREATE:
{
	InitCommonControls();
	CREATESTRUCT *cs=reinterpret_cast<createstruct*>(lParam);			
	int desktopwidth=GetSystemMetrics(SM_CXSCREEN);

	hp_L = CreateWindowEx(WS_EX_CLIENTEDGE,_T("button"),_T("<"),WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,0,0,30,PICBOX,hwnd,(HMENU)ID_CHLDWND_PREV,cs->hInstance,0);
	hp_R = CreateWindowEx(WS_EX_CLIENTEDGE,_T("button"),_T(">"),WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,desktopwidth-30,0,30,PICBOX,hwnd,(HMENU)ID_CHLDWND_NEXT,cs->hInstance,0);
	hpbox   = CreateWindowEx(WS_EX_CLIENTEDGE,_T("static"),_T(""),WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,0,0,0,0,hwnd,(HMENU)ID_CHLDWND_DASH,cs->hInstance,0);
	return 0;
}


case WM_SIZE:
	if (wParam==SIZE_MAXIMIZED)
	{
		SetWindowLongPtr(hpbox,GWL_EXSTYLE,0);
		SetWindowLongPtr(hp_L,GWL_EXSTYLE,0);
		SetWindowLongPtr(hp_R,GWL_EXSTYLE,0);
	}
	else
	{
		SetWindowLongPtr(hpbox,GWL_EXSTYLE,WS_EX_CLIENTEDGE);
		SetWindowLongPtr(hp_L,GWL_EXSTYLE,WS_EX_WINDOWEDGE);
		SetWindowLongPtr(hp_R,GWL_EXSTYLE,WS_EX_CLIENTEDGE);
	}
	MoveWindow(hpox,0,0,LOWORD(lParam),HIWORD(lParam),true);
	MoveWindow(hp_L,0,0,30,PICBOX,true);
	MoveWindow(hp_R,0,0,LOWORD(lParam),HIWORD(lParam),true);



Thanks;
Posted
Updated 25-Apr-12 0:08am
v2

1 solution

Could you please clarify what do you mean by the form?

You are referring to forms as treeview form and information form. Are forms dialogs?

Also, could you give more detailed information about sizing problem?
If you do not click anything, does the client window changes size? What class is your client window?

Why are you trying to do in with Win32 API only? I think using MFC would make your life a lot easier.
 
Share this answer
 
v2
Comments
01.mandar 26-Apr-12 7:18am    
Thanks John, actually to overcome this problem now i assigned an ID to every window i have created, these id helped me in manage there size events.
i would surely move to MFC :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900