Solved

Can 2 MDIChild forms be opened without effecting each other.

Posted on 2001-08-16
3
277 Views
Last Modified: 2010-05-02
I am trying to have to MDIChild forms open at the same time without effecting the Windowstate of the other.  One needs to stay maximized while the other is opened in a Normal state. Can this be done? If so, how?
0
Comment
Question by:joesmow
3 Comments
 
LVL 3

Expert Comment

by:Bahnass
ID: 6395194
I think No if One is maxmized
But U can make it as if it is maximized
(width & Height of MDI )

Waiting 4 Experts
0
 
LVL 2

Accepted Solution

by:
PeteD earned 50 total points
ID: 6395242
'if you set the mdichild property of Form2 = false
Option Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Private Sub MDIForm_Load()
    Form1.Show
    Form1.WindowState = vbMaximized
    Form2.Show 0
    SetParent Form2.hWnd, hWnd
End Sub
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6396165
joesmow, the simple answer is no, the complex answer is maybe.

No: the MDI rules are that if any window is maximized, you effectively maximize any non-minimized windows at the same time, i.e. only one window can be maximized at a time in the MDI parent.

Maybe: PeteD's code would work to give you a simulation of this, however the SetParent call does not truly make the window into an MDIChild so whilst it will to some extent appear to be a child window you would have to add additional checking such as the window position within the MDI form to display/turn off scroll bars etc as these will not necessarily work properly.

I don't understand your specific reasons for wanting this, generally speaking I only use this kind of thing when displaying a modal form as a dialog or warning etc. Then I make this form a non-MDIChild and centre it over the MDI form. I generally prefer to stick within the MDI framework and modify my design rather than have to handle pseudo-MDIChildren in this way.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now