Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Game Engine Import
#2
In order to open an extarnal program you need to get it's handle and change it and to do that you need to use 2 functions SetParent and ShowWindow , and 1 const SW_MAXIMIZE

[code2=vbnet]Declare Function ShowWindow Lib "user32" (ByVal hWnd As System.IntPtr, ByVal nCmdShow As Integer) As Boolean
Declare Function SetParent Lib "user32" (ByVal hWndChild As System.IntPtr, ByVal hWndNewParent As System.IntPtr) As System.IntPtr
Private Const SW_MAXIMIZE As Integer = 3[/code2]

Now you used Panel1.Paint event witch is the worst event to use because everytime the panel is redrawwn it will open the program again and again . I sugest using either a button or the form load event. Here is the code to open the program in your pannel

[code2=vbnet]Dim pinfo As New ProcessStartInfo("C:\Program Files (x86)\Unity\Editor\unity.exe")
Dim p As Process = System.Diagnostics.Process.Start(pinfo)
System.Threading.Thread.Sleep(50)

SetParent(p.MainWindowHandle, Me.Panel1.Handle)
ShowWindow(p.MainWindowHandle, SW_MAXIMIZE)[/code2]

The code above should do the trick.
Sssssssssoftware developer...


Messages In This Thread
Game Engine Import - by arrelin1 - 05-27-2013, 05:17 PM
Re: Game Engine Import - by Snake_eyes - 05-29-2013, 03:02 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Visual Basic Game Atri 3 14,558 09-05-2012, 02:57 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)