1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| ///public partial class Form2 : 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);
private void vbox_Click(object sender, EventArgs e)
{
Process p = Process.Start(@"C:\Program Files\Oracle\VirtualBox\VirtualBox.exe");
p.WaitForInputIdle();
while (p.MainWindowHandle == IntPtr.Zero || string.IsNullOrEmpty(p.MainWindowTitle))
{
Thread.Sleep(100);
p.Refresh();
}
SetParent(p.MainWindowHandle, panelAutodesk.Handle);
/// }
} |
Partager