1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
public partial class Form1 : Form
{
[DllImport("user32.dll")]
private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
public Form1()
{
InitializeComponent();
}
private void btnRun_Click(object sender, EventArgs e)
{
Process p = Process.Start(@"C:\Program Files\Notepad++\notepad++.exe");
p.WaitForInputIdle();
SetParent(p.MainWindowHandle, this.Handle);
SetWindowPos(p.MainWindowHandle, IntPtr.Zero, 50, 50, 600, 500, 0);
}
} |
Partager