运行在C#.NET应用程序面板的exe文件 [英] to run an exe file in the panel of c#.net application

查看:245
本文介绍了运行在C#.NET应用程序面板的exe文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我想用在面板在我的WinForm .NET应用程序运行的exe文件c#code
  2. 在我能够与 System.Diagnostics.ProcessStartInfo 进程p =的Process.Start(记事本运行按钮点击exe文件.EXE); 但什么是code。使用C#code运行面板在这个记事本文件或任何其他的EXE文件
  3. 我要运行面板中的应用程序不能在单独window.i已运行下面的code,但该exe并没有停留在屏幕上,也不是在面板中打开 请告诉我这种情况的解决方案。

     进程p =的Process.Start(Notepad.exe的);
        Thread.sleep代码(600); //允许该过程以打开它的窗口
        的setparent(p.MainWindowHandle,panel1.Handle);
    
    
    [的DllImport(user32.dll中)
    静态外部的IntPtr的setparent(IntPtr的hWndChild,IntPtr的hWndNewParent);
     

解决方案

我想你所谈论的是嵌入的应用程序在你的面板。

这是唯一可能与已创建要被嵌入的可执行文件。记事本是不是其中之一。某些浏览器可以是 - Mozilla的是一个例子,和的 IE 是另一回事。

  1. I want to run an exe file on my winform .net application within the panel using c# code
  2. I'm able to run exe file on the button click with System.Diagnostics.ProcessStartInfo and Process p = Process.Start("notepad.exe"); but what is the code to run this notepad file or any other exe file within the panel using c# code?
  3. I want to run the application within the panel not on the separate window.i had run the following code but the exe does not stay on the screen nor it opens within the panel please tell me the solution for this.

        Process p = Process.Start("notepad.exe");
        Thread.Sleep (600);  // Allow the process to open it's window 
        SetParent(p.MainWindowHandle, panel1.Handle);
    
    
    [DllImport("user32.dll")]
    static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
    

解决方案

I think what you are talking about is embedding an application in your panel.

This is only possibly with executables that have been created to be embedded. Notepad is not one of those. Some browsers can be - Mozilla is one example, and IE is another.

这篇关于运行在C#.NET应用程序面板的exe文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆