Hi :)
I'm creating a kind of virtualbox (I'm just trying to learn with mini-projects and stuff). I've found a way to open applications within the dimensions of the windows form. So once I thought I had found a solution for this, I began testing it on different applications; it works with notepad, firefox, etc (they all open within the form itself). However, I tried it on a video game (RuneScape [don't judge lel]) and only the splash screen opened in the form. Once the splash screen had loaded the game's resourced, and the main client/game process started, the client opened outside of the box. In the task manager, it seems like the launcher and the client process rely on one another (i.e. if I kill rs2client.exe and leave runescape.exe running, both kill themselves and the game dies - and vice versa). How do I make it so that the window (main game client) that opens after the splash screen remains inside the form, just as the splash screen did?
This is my current code:
Option Strict On
Option Explicit On
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
Dim proc As Process
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
proc = Process.Start("C:\Program Files\Jagex\RuneScape Launcher\runescape.exe")
proc.WaitForInputIdle()
proc.WaitForExit(1000)
SetParent(proc.MainWindowHandle, Panel1.Handle)
End Sub
End Class
What I have tried:
I've tried this (probably a very ill attempt for a solution):
Option Strict On
Option Explicit On
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
Dim proc As Process
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
proc = Process.Start("C:\Program Files\Jagex\RuneScape Launcher\runescape.exe")
proc.WaitForInputIdle()
proc.WaitForExit(1000)
SetParent(proc.MainWindowHandle, Panel1.Handle)
proc = Process.Start("C:\ProgramData\Jagex\Launcher\rs2client.exe")
proc.WaitForInputIdle()
proc.WaitForExit(1000)
SetParent(proc.MainWindowHandle, Panel1.Handle)
End Sub
End Class
Thanks so much for any help! If you give a really complicated answer, that I don't know how to actually implement, be prepared to endure my inexperience (I'm trying to learn xD)!