1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
IntPtr hWndDocked = IntPtr.Zero;
Process pDocked = new Process();
pDocked.StartInfo.FileName = @"cmd";
pDocked.Start();
while (hWndDocked == IntPtr.Zero)
{
pDocked.Refresh(); //update process info
if (pDocked.HasExited)
{
return null; //abort if the process finished before we got a handle.
}
hWndDocked = pDocked.MainWindowHandle; //cache the window handle
}
uint lStyle = GetWindowLong(hWndDocked, GWL_STYLE);
lStyle &= ~(
WindowStyles.WS_SYSMENU
| WindowStyles.WS_THICKFRAME
//| WindowStyles.WS_BORDER
| WindowStyles.WS_CAPTION
| WindowStyles.WS_OVERLAPPED
);
SetWindowLong(hWndDocked, GWL_STYLE, lStyle);
SetWindowPos(hWndDocked, HWND_TOP, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); |
Partager