我想把网上下的别人做好的软件作为我程序的子界面来用,请问大家有什么办法让调用的这个exe文件不脱离我的主窗体,并受我主窗体控制,比如,我主窗体最小化的时候我调用的这个exe软件也最小化,我的主窗体退出的话他们也退出。
大家要是做过这方面的东西,给个提示,谢谢了!有演示类型的代码更好!
大家要是做过这方面的东西,给个提示,谢谢了!有演示类型的代码更好!
解决方案 »
- |ZYCWPF| RTP包在UDP中大小应该是多大,对数据大的,如何进行拆包呢?
- C#.net中的20多种设计模式中,哪些设计模式用的更多?
- c# winform 怎么让flash全屏 调用fscommand
- c#颜色和名称对照表
- 谁能重绘窗口的标题栏不闪烁???找到答案后100分献上!!!
- 头晕了,又是一个正则表达式的问题,请高人指点一下。
- 问:如何将项目中一个文件夹下的,或一个名空间的类打包成DLL
- 三元数据问题如何处理更好?
- Winform的 Button 的 鼠标 和 空格 事件 ??按下弹起状态??
- WinForm ListView显示图片居中
- C#如何调用VC++.NET编写的CLR类库
- 简单C问题,求助
public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32", EntryPoint = "FindWindowA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", EntryPoint = "SendMessageA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int SendMessage(int hwnd, int wMsg, int wParam, int lParam);
[DllImport("shell32.dll", EntryPoint = "ShellExecuteA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int ShellExecute(int hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);
private const int WM_SYSCOMMAND = 0x112;
private const int SC_MAXIMIZE = 0xF030;
private const int SC_MINIMIZE = 0xF020;
private const int SC_RESTORE = 0xF120;
public const int SW_HIDE = 0;
public const int SW_SHOW = 5;
[DllImport("user32.dll ", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int ShowWindow(int hwnd, int nCmdShow);
ShellExecute(this.panel1.Handle.ToInt32(), "open", @"c:\\windows\\system32\\cmd.exe", null, ".", SW_HIDE); // 让cmd.exe运行在PANEL里
IntPtr h = FindWindow(null, "c:\\windows\\system32\\cmd.exe");
var frm = (Control)Form.FromHandle(h);
SetParent(h, this.panel1.Handle); //嵌套到panel1内
SendMessage(h.ToInt32(), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
ShowWindow(h.ToInt32(), SW_SHOW);
要是已经做好的带窗体的软件的话
就不行了
大家有没有能够实现的高人
分享下方法