110,536
社区成员
发帖
与我相关
我的任务
分享
private void OpenProcess(string exefile, int width, int height)
{
ProcessStartInfo psi = new ProcessStartInfo(exefile);
psi.WindowStyle = ProcessWindowStyle.Normal;
Process p = Process.Start(psi);
int time = 3000;
while (!p.HasExited && time > 0)
{
p.Refresh();
IntPtr hwnd = p.MainWindowHandle;
if (hwnd.ToInt32() != 0)
{
SetWindowPos(hwnd, 0, 0, 0, width, height, 0x46);
break;
}
time -= 100;
}
}
[DllImport("user32")]
private static extern int SetWindowPos(IntPtr hwnd, int hWndInsertAfter, int x, int y, int w, int h, int flag);