Click here to Skip to main content
16,006,065 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OpenFile dialog with source sontrol Pin
markshte14-Dec-05 23:53
markshte14-Dec-05 23:53 
GeneralRe: OpenFile dialog with source sontrol Pin
markshte14-Dec-05 23:57
markshte14-Dec-05 23:57 
GeneralRe: OpenFile dialog with source sontrol Pin
markshte14-Dec-05 23:47
markshte14-Dec-05 23:47 
QuestionHow to get virtual memory usage Pin
sachin.kumar14-Dec-05 22:37
sachin.kumar14-Dec-05 22:37 
AnswerRe: How to get virtual memory usage Pin
ThatsAlok14-Dec-05 22:48
ThatsAlok14-Dec-05 22:48 
GeneralRe: How to get virtual memory usage Pin
sachin.kumar14-Dec-05 23:17
sachin.kumar14-Dec-05 23:17 
QuestionDirect x using c++ Pin
marihan14-Dec-05 22:33
marihan14-Dec-05 22:33 
QuestionMDI child area with and without 3D border Pin
icklePhil14-Dec-05 22:23
icklePhil14-Dec-05 22:23 
Hello!

I'm developping a MDI application in MS Visual C++ .NET (Managed C++ and GUI-Designer).
As my child windows are of dialog style (3D border and grey), I looked for a way to remove the inside 3D border of the MDI child area while the child windows are maximized and to put the border back on if they are normalized again.
All this because it doesn't look very nice when you maximize a 3D bordered window in another 3D bordered window (you get a "double border" then).
See these pictures illustrating what I mean:
Normal child window:
http://www.geocities.com/icklephilipp/ura_situation1.gif
Maximized child window with "double border":
http://www.geocities.com/icklephilipp/ura_situation2.gif
Maximized child window with merged border (this is what it should look like):
http://www.geocities.com/icklephilipp/ura_situation3.gif
I did manage to remove the 3D border with this code:
To remove the border:
System::Void MainForm::AddClientEdge(System::Windows::Forms::MdiClient* mdi)
{
	if (mdi != NULL) {
		// Get Styles using Win32 calls
		int style = GetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_STYLE);
		int exStyle = GetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_EXSTYLE);
		// Add borders on the Mdi.
		style &= ~WS_BORDER;
		exStyle |= WS_EX_CLIENTEDGE;
		// Set Styles using Win32 calls
		SetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_STYLE, style);
		SetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_EXSTYLE, exStyle);
		// SWP_FRAMECHANGED using Win32 call
		SetWindowPos((HWND)mdi->Handle.ToPointer(), (HWND)IntPtr::Zero.ToPointer(), 0, 0, 0, 0,
			SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
	}
}
To put the border back on:
System::Void MainForm::RemoveClientEdge(System::Windows::Forms::MdiClient* mdi)
{
	if (mdi != NULL) {
		// Get Styles using Win32 calls
		int style = GetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_STYLE);
		int exStyle = GetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_EXSTYLE);
		// Remove any borders on the Mdi.
		style &= ~WS_BORDER;
		exStyle &= ~WS_EX_CLIENTEDGE;
		// Set Styles using Win32 calls
		SetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_STYLE, style);
		SetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_EXSTYLE, exStyle);
		// SWP_FRAMECHANGED using Win32 call
		SetWindowPos((HWND)mdi->Handle.ToPointer(), (HWND)IntPtr::Zero.ToPointer(), 0, 0, 0, 0,
			SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
	}
}
The big problem now occurring is shown in this picture:
http://www.geocities.com/icklephilipp/ura_strange.gif
The menubar of the main window changes like this if one switches between different child windows via the "Window" menu while the child windows are maximized.
Does anyone know, what relation these two functions have in particular?
I don't get it at all! Eek! | :eek:

I'm grateful for any ideas or thoughts!

Greets, icklePhil
AnswerRe: MDI child area with and without 3D border Pin
icklePhil22-Dec-05 4:00
icklePhil22-Dec-05 4:00 
QuestionHow to get the browsername? Pin
Shailesh Ha14-Dec-05 22:17
Shailesh Ha14-Dec-05 22:17 
AnswerRe: How to get the browsername? Pin
David Crow15-Dec-05 2:31
David Crow15-Dec-05 2:31 
QuestionStupit Syntax Error Pin
Ametal14-Dec-05 22:06
Ametal14-Dec-05 22:06 
AnswerRe: Stupit Syntax Error Pin
toxcct14-Dec-05 22:17
toxcct14-Dec-05 22:17 
GeneralRe: Stupit Syntax Error Pin
Ametal14-Dec-05 22:25
Ametal14-Dec-05 22:25 
AnswerRe: Stupit Syntax Error Pin
8ki14-Dec-05 22:29
8ki14-Dec-05 22:29 
GeneralRe: Stupit Syntax Error Pin
Ametal14-Dec-05 22:35
Ametal14-Dec-05 22:35 
GeneralRe: Stupit Syntax Error Pin
toxcct14-Dec-05 23:03
toxcct14-Dec-05 23:03 
AnswerRe: Stupit Syntax Error Pin
kakan14-Dec-05 22:37
professionalkakan14-Dec-05 22:37 
GeneralRe: Stupit Syntax Error Pin
Ametal14-Dec-05 22:39
Ametal14-Dec-05 22:39 
GeneralRe: Stupit Syntax Error Pin
kakan14-Dec-05 22:44
professionalkakan14-Dec-05 22:44 
GeneralRe: Stupit Syntax Error Pin
Ametal14-Dec-05 22:45
Ametal14-Dec-05 22:45 
GeneralRe: Stupit Syntax Error Pin
kakan14-Dec-05 22:47
professionalkakan14-Dec-05 22:47 
AnswerRe: Stupit Syntax Error Pin
khan++14-Dec-05 23:11
khan++14-Dec-05 23:11 
GeneralRe: Stupit Syntax Error Pin
Ametal14-Dec-05 23:14
Ametal14-Dec-05 23:14 
QuestionRe: Stupit Syntax Error Pin
David Crow15-Dec-05 2:33
David Crow15-Dec-05 2:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.