?
Solved

Can 2 MDIChild forms be opened without effecting each other.

Posted on 2001-08-16
3
Medium Priority
?
285 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 200 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

850 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