我用下面方法启动的一个具有窗口的应用程序Apps:
   System.Diagnostics.Process Apps;
   Apps.Start();
   我怎么用代码设置Apps在屏幕上显示的位置呢?我还想设定Apps窗口的大小(Apps运行的窗体是可用鼠标移动、调节大小的),有什么办法吗?

解决方案 »

  1.   


    [DllImport("user32.dll", SetLastError = true)]
    private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
    [DllImport("user32.dll", SetLastError = true)]
    private static extern long SetWindowPos(IntPtr hwnd, long hWndInsertAfter, long x, long y, long cx, long cy, long wFlags);
    [DllImport("user32.dll", SetLastError = true)]
    private static extern bool MoveWindow(IntPtr hwnd, int x, int y, int cx, int cy, bool repaint);
      

  2.   

    不是设置窗体的Location属性吗?
      

  3.   

    谢谢cja03给的API,还有.net的方法吗?
      

  4.   

    如果你有Apps的源码的话好办
    直接使用
    this.StartPosition = FormStartPosition.Manual;
                this.Location = new Point(
                    Screen.PrimaryScreen.WorkingArea.Width - this.Width,
                    Screen.PrimaryScreen.WorkingArea.Height - this.Height );否则
    ProcessStartInfo info = new ProcessStartInfo( "iexplorer.exe", "这里的参数具体依赖EXE本身是否支持!" );
      

  5.   

    楼上的几位,问题就是Apps.exe是第三方软件!
      

  6.   

    直接用窗口的LEFT,TOP属性就可以了,没有他们说的那样复杂,二下就搞定。