Solved

Keeping Non-MDI forms within a Main form?

Posted on 2006-11-07
3
197 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
  • 2
3 Comments
 
LVL 85

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 85

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 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
word0 challenge 3 90
Windows Service to Receive TCP Packets 4 144
Modify a small python script 19 108
Help Required 3 90
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

813 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

16 Experts available now in Live!

Get 1:1 Help Now