|
-
Jul 24th, 2012, 08:23 AM
#1
Thread Starter
New Member
Opening exe inside vb.net form
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!
-
Jul 24th, 2012, 10:26 AM
#2
Junior Member
Re: Opening exe inside vb.net form
Try this thread, i saw it yesterday on the forum.
http://www.vbforums.com/showthread.php?t=684771
-
Jul 25th, 2012, 07:00 AM
#3
Thread Starter
New Member
Re: Opening exe inside vb.net form
Thanks that helped a lot. Now the only problem that the application is free moving around the parent app. Is there a way to anchor it to the page?
-
Jul 27th, 2012, 02:19 PM
#4
Re: Opening exe inside vb.net form
Yup. Maximise! That's also covered in the other thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|