Start New Discussion within our Software Development Community

i have a webproject to work on and it requires quite a few applications, windows explorers, etc. to work on..

what i was wondering is, if i can open my applications, like shelling them, but in a tab control, so when i start my app, it has firefox loaded in tabpage1, notepad ++ in tabpage2, graphics program in 3, and so on... that way they're always in a set order, which is sometimes hard to do with the taskbar..

trujade..

this is what i have so far:

<icode>
Imports System.Runtime.InteropServices
Public Class Form1

Private Const WM_SYSCOMMAND As Long = &H112
Private Const SC_MAXIMIZE As Long = &HF030 ' Maximize window
Private Const SC_MINIMIZE As Long = &HF020 ' Minimize window
Private Const SC_CLOSE As Long = &HF060 ' Close window

Declare Auto Function SetParent Lib "user32" (ByVal HWNDChild As IntPtr, _
ByVal HWNDNewParent As IntPtr) As IntPtr

<DllImport("User32.dll")> _
Public Shared Function SetForegroundWindow(ByVal Hwnd As IntPtr) As Boolean
End Function

<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function SendMessage(ByVal hWnd As Integer, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As Integer
End Function

Private Sub Button1_Click(ByVal Sender As System.Object, _
ByVal E As System.EventArgs) Handles Button1.Click

Dim PR As Process = Process.Start("notepad")
PR.WaitForInputIdle()
SetParent(PR.MainWindowHandle, TabControl1.TabPages(0).Handle)
SetForegroundWindow(PR.MainWindowHandle)

SendMessage(PR.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0)

End Sub
End Class

</icode>

what this does is open notepad in tabcontrol.. works fine.. but, when i try to load a different app like firefox, or any other app, i can't seem to figure it out how...

do reply if you know how to fix this code in order to open one of my apps in the tabcontrol..

thanx..

trujade..

This article has been dead for over six months. Start a new discussion instead.