Advertisement
Guest User

Unity embed EXE in game window

a guest
Aug 20th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class LoadChild : MonoBehaviour {
  5.  
  6.     // Update is called once per frame
  7.     void Update () {
  8.         if(Input.GetKeyDown(KeyCode.D))
  9.         {
  10.             int thisHandle = GetWindowHandle().ToInt32();
  11.             System.Diagnostics.Process.Start("child.exe","-parentHWND "+thisHandle);
  12.         }
  13.     }
  14.  
  15.     [System.Runtime.InteropServices.DllImport("user32.dll")]
  16.     private static extern System.IntPtr GetActiveWindow();
  17.  
  18.     public System.IntPtr GetWindowHandle()
  19.     {
  20.         return GetActiveWindow();
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement