Open IExplore.exe as MDI child in VB.net app

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
I know it's possible to do this in .Net 1.1, I just cannot find the code snippet I saw a few years ago that did this.

I'm trying to open other programs as children of my program like an MDI app. I would like it where IExplore (or FireFox and Opera) open as a child and when the user clicks the Maximize button the form expands to fill the bounds of my window.

An article would also be nice, Thanks.
 
Hi,
I was trying to make notepad.exe as child to Form1 and the code snippet I tried is given below.
VB.NET:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        proc = Process.Start("notepad.exe")
        win32.removeTitleBarAndRescale(proc.MainWindowHandle)
        win32.SetParent(proc.MainWindowHandle, Me.Handle)
        win32.SetWindowPos(proc.MainWindowHandle, Me.Handle, 0, 0, Me.Width, Me.Height, win32.SWP_FRAMECHANGED Or win32.SWP_NOZORDER)
    End Sub

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
        win32.SetWindowPos(proc.MainWindowHandle, Me.Handle, 0, 0, Me.Width, Me.Height, win32.SWP_FRAMECHANGED Or win32.SWP_NOZORDER)
    End Sub

Now the problem is that notepad will be shown at first as a different application and then it will become the child of Form1(of course its coded like that) and its weird. I would like to know whether I can load my windows application with notepad as the child.

I tried to open notepad with window style as hidden and tried to use showwindow function to show notepad back and since the windowstyle is hidden i'm not able to get the mainwindowhandle. The code I tried is as follows
VB.NET:
        proc = New Process
        proc.StartInfo.FileName = "notepad.exe"
        proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
        proc.Start()

VB.NET:
        win32.ShowWindow(proc.MainWindowHandle, 3) 'proc.MainWindowHandle is always 0

Thanks in advance
 
I ran into that problem too.

Also none of that code works for operah and firefox, i gave up after that
 
Back
Top