Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Keeping Non-MDI forms within a Main form?

Posted on 2006-11-07
3
Medium Priority
?
209 Views
Last Modified: 2010-04-16
I am using non-MDI forms in my application only because the ability to add a MDI form has been disabled in the Project menu (don't know why either). Anyway, I have an active main form and when I show a new form....I wish for it to remain in the main form. I've seen an example of this before but can't remember where.

Thanks!
0
Comment
Question by:BlakeMcKenna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 17894040
Why do you have two accounts Blake?...
http://www.experts-exchange.com/Programming/Q_22052432.html
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 17894506
You can make a form a pseudo-mdi child using the SetParent() API:

Option Explicit

Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
   
Private Sub Command1_Click()
    Dim f2 As New Form2
    f2.Show
    SetParent f2.hWnd, Me.hWnd
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Dim f As Form
    For Each f In Forms
        Unload f
    Next f
End Sub
0
 
LVL 5

Accepted Solution

by:
sivachirravuri earned 1500 total points
ID: 17912660
this API can be used to keep window on top or center.

Private Declare Function SetWindowPos _
                Lib "user32" _
                (ByVal hwnd As Long, _
                 ByVal hWndInsertAfter As Long, _
                 ByVal x As Long, ByVal Y As Long, _
                 ByVal cx As Long, ByVal cy As Long, _
                 ByVal wFlags As Long) As Long

Private sub Form_load()
l = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 1)
End sub
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Introduction to Processes
Starting up a Project

704 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