使用c#(WPF)以窗口形式运行现有EXE [英] Existing EXE run with in a window form using c#(WPF)
本文介绍了使用c#(WPF)以窗口形式运行现有EXE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们好!
我需要在窗口窗体中执行现有的EXE文件。但是Exe不会显示在窗口外面。如果我最小化exe,它将在同一窗口中最小化..这可能吗?请帮帮我......
Hello friends!
I need to execute existing EXE file within a window form. but Exe will not show outside of the window. if i minimize the exe, it will minimize in a same window.. is this possible? please help me......
推荐答案
// import needed functions from user32 lib
[DllImport("user32.dll")]
public static extern int SetParent(IntPtr hWndChild , IntPtr hWndNewParent);
[DllImport("user32.dll")]
public static extern int SendMessage (IntPtr hWnd , int Msg , int wParam , int lParam);
// variables used to call teh functions
const int WM_SYSCOMMAND = 274;
const int SC_MAXIMIZE = 61488;
// defining the process and initilize it's attributes
Process p=new Process();
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.UseShellExecute = false;
//starting notepad and put it within the form
p = Process.Start("NOTEPAD.EXE");
p.WaitForInputIdle();
SetParent(p.MainWindowHandle, this.Handle);
SendMessage(p.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
否。
如果不改变EXE本身,这是不可能的。
No.
It isn't possible, without changing the EXE itself.
Flash打开表单...
全屏
我靠近它... alt f4
如何在表格中打开Flash文件?
Flash扩展名为
执行
喜欢flash游戏
Flash opens out the form ...
Full screen
I have it close by ... alt f4
How do I open a Flash file in Form ?
Flash extension is
It Executive
Like a flash game
这篇关于使用c#(WPF)以窗口形式运行现有EXE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文