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:
Imports System.Diagnostics.Process
Imports System.Runtime.InteropServices
Public Class Form1
Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
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
Private Const WM_SYSCOMMAND As Integer = 274
Private Const SC_MAXIMIZE As Integer = 61488
Private proc As Process = New Process()
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
proc = Process.Start("notepad.exe")
proc.WaitForInputIdle()
SetParent(proc.MainWindowHandle, Panel1.Handle)
SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
End Sub
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!