美文网首页
winform调用exe

winform调用exe

作者: 到底要多久 | 来源:发表于2016-05-26 22:43 被阅读0次

    private void button1_Click(object sender, EventArgs e)

    {

    System.Diagnostics.Process p = System.Diagnostics.Process.Start("calc");//notepad");

    p.WaitForInputIdle();

    SetParent(p.MainWindowHandle, this.Handle);

    ShowWindowAsync(p.MainWindowHandle, 3);

    }

    [DllImport("user32.dll")]

    static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

    [DllImport("user32.dll")]

    private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);

    相关文章

      网友评论

          本文标题:winform调用exe

          本文链接:https://www.haomeiwen.com/subject/chmxdttx.html