private void CreateNativeProcess()
        {
            this.Process                = ProcessCreator.CreateProcess(ApplicationString);
            Application.Current.Exit   += (x, y) => Process.Kill();
            Process.EnableRaisingEvents = true;
            Process.Exited             += Process_Exited;

            Thread.Sleep(100); //BAD, need a better way to wait for signal

            //Gets the current window style, removes the border from it (~0x00450000)
            ExternalFunctions.SetWindowLong(Process.MainWindowHandle, -16, (int)(ExternalFunctions.GetWindowLong(Process.MainWindowHandle, -16) & ~0x00450000));

            System.Windows.Forms.ContainerControl panel1 = new System.Windows.Forms.ContainerControl();

            IntPtr value = ExternalFunctions.SetParent(Process.MainWindowHandle, panel1.Handle);

            this.Window = Process.MainWindowHandle;

            //HookNativeKeyboardEvent();

            this.Content = new System.Windows.Forms.Integration.WindowsFormsHost()
            {
                Child = panel1
            };
        }
 private void HookNativeKeyboardEvent()
 {
     _lowLevelKeyBoardReference = LowLevelKeyboardProc; //Store a reference to this function pointer, as it gets invoked from unmanaged code
     ExternalFunctions.SetWindowsHookEx(13, _lowLevelKeyBoardReference, ExternalFunctions.GetWindowLong(Process.MainWindowHandle, -6), 0);
 }