运行在C#.NET应用程序面板的exe文件应用程序、面板、文件、NET

2023-09-02 21:41:17 作者:花花世界、花花心

我想用在面板在我的WinForm .NET应用程序运行的exe文件c#code 在我能够与 System.Diagnostics.ProcessStartInfo 进程p =的Process.Start(记事本运行按钮点击exe文件.EXE); 但什么是code。使用C#code运行面板在这个记事本文件或任何其他的EXE文件?

我要运行面板中的应用程序不能在单独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 是另一回事。

I want to run an exe file on my winform .net application within the panel using c# code 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? 怎么用C语言让bat文件成功在DOS操作系统中运行

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.

 
精彩推荐
图片推荐