如何使用c#在指定位置启动进程窗口

时间:2015-12-06 18:28:03

标签: c# exec

我需要启动5个不同的进程并在特定的X,Y坐标处显示窗口。我尝试过以下方法:

[DllImport("user32.dll", SetLastError = true)]
private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint);

for (int k = 0; k < numberOfProcess;k++ )
{
    myProcess = new Process();
    myProcess.StartInfo.UseShellExecute = false;
    myProcess.StartInfo.CreateNoWindow = true;
    myProcess.StartInfo.FileName = uitbFileLocation.Text;
    myProcess.Start();
    if ((i + 1) * Delta < 2 * R)
    {
        X = i * Delta;
    }
    else
    {
        X = 2 * R;
        sign = -1;
        i = 0;
    }
    bool one = MoveWindow(myProcess.MainWindowHandle, X, Calcuate(R, X, sign), 334, 362, false);

但“moveWindow”总是返回false并且没有任何反应。

0 个答案:

没有答案