开发者

to run an exe file in the panel of c#.net application

  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(In开发者_开发技巧tPtr 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.


I guess you are looking for this: Window Tabifier


What are you trying to do? you know that if its your own programs you want to run in the panel you could write some basic plugin code and get a control from a assembly with reflection..


What you want is pipe the output of the exe to your process. Usually when you do not do not pipe the output it defaults to stdout for a console application will be the console window by piping you are telling the exe you want the output to come to your process not the console window. Then you would have to create your own "panel" (a multiline textbox) and append the the output stream from the exe you invoked to it!

Learn here: http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput(v=VS.90).aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜