C#代码执行exe程序后,如何放到一个控件上显示?如panel

编程爱好者L 2010-09-06 11:07:34
问题如标题,请看标题↑↑↑↑.......
...全文
545 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyq11 2010-09-06
  • 打赏
  • 举报
回复
[DllImport("User32.dll ", EntryPoint = "SetParent")]
private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll ", EntryPoint = "ShowWindow")]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
private void button1_Click(object sender, EventArgs e)
{
Process p = new Process();
p.StartInfo.FileName = "";
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized; p.Start();
System.Threading.Thread.Sleep(100);
SetParent(p.MainWindowHandle, this.Handle);
ShowWindow(p.MainWindowHandle, 3);

}
ZengHD 2010-09-06
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 qq123592624 的回复:]

如何把執行檔放入Panel中?
[/Quote]

API SetParent
编程爱好者L 2010-09-06
  • 打赏
  • 举报
回复
如何把執行檔放入Panel中?
编程爱好者L 2010-09-06
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 zerodegrees 的回复:]
显示需要对象吧,你想显示什么……
[/Quote]
我向现实的就是我要执行的程序
zerodegrees 2010-09-06
  • 打赏
  • 举报
回复
显示需要对象吧,你想显示什么……
hckings 2010-09-06
  • 打赏
  • 举报
回复
调用Windows API 的FindWindow和SetParent方法
hanepdcbei 2010-09-06
  • 打赏
  • 举报
回复
不明白啥意思。。。
编程爱好者L 2010-09-06
  • 打赏
  • 举报
回复
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string classname, string windowname);
[DllImport("user32.dll")]
public static extern IntPtr SetParent(IntPtr Child,IntPtr Parent);

使用:
IntPtr h = FindWindow(null,"資訊系統");
SetParent(h,WorkPanel.Handle);
谁可以解释一下这几行代码吗?
编程爱好者L 2010-09-06
  • 打赏
  • 举报
回复
比如说我执行了一个名为123.exe的程序,然后如何把它放到一个容器控件里显示出来.
hckings 2010-09-06
  • 打赏
  • 举报
回复
没看懂- -
Love_Air523824 2010-09-06
  • 打赏
  • 举报
回复

嘛意思??
porschev 2010-09-06
  • 打赏
  • 举报
回复
albert528108 2010-09-06
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 qq123592624 的回复:]
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string classname, string windowname);
[DllImport("user32.dll")]
public static extern IntPtr SetParent(IntPtr Child,IntPtr Parent);
……
[/Quote]

FindWindow 通过窗口名称找到窗口句柄,再调用SetParent把找到的窗口和Panel控件句柄做为SetParent的参数
renyouprince 2010-09-06
  • 打赏
  • 举报
回复
每天回帖即可获得10分可用分!

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧