Hi,
I'm having a little trouble when trying to open executables and set them in a panel in my form.

Currently I have:
VB.net Code:
  1. Imports System.Diagnostics.Process
  2. Imports System.Runtime.InteropServices
  3.  
  4. Public Class Form1
  5.     Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
  6.     Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
  7.     Private Const WM_SYSCOMMAND As Integer = 274
  8.     Private Const SC_MAXIMIZE As Integer = 61488
  9.     Private proc As Process = New Process()
  10.  
  11. Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  12.     proc = Process.Start("notepad.exe")
  13.     proc.WaitForInputIdle()
  14.     SetParent(proc.MainWindowHandle, Panel1.Handle)
  15.     SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
  16.     End Sub
  17.  
  18. End Class

what throws me is that the code works when i use "notepad.exe" but no other executable say mspaint or another windows an help will be appriciated!