我的目标是将打牌窗口的位置设置为一些特定的坐标(例如200x400)。
最初,我尝试使用播放命令行参数,但我只发现如何设置窗口的宽度和高度,而不是位置。
然后我尝试在特定位置中使用C#打开进程,但这似乎不影响FFPlay的位置
如有任何建议,将不胜感激。
这是我的代码:
static void Main(string[] args)
{
Process proccess = new Process();
proccess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
proccess.StartInfo.FileName = "C:\\ffmpeg\\x64\\ffplay.exe";
proccess.StartInfo.Arguments = "udp://@127.0.0.1:5004?pkt_size=1316";
proccess.Start();
Thread.Sleep(100);
IntPtr id = proccess.MainWindowHandle;
Console.Write(id);
Program.MoveWindow(proccess.MainWindowHandle, 0, 0, 500, 500, true);
}
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
发布于 2022-07-15 07:27:42
在命令行中,您可以使用以下选项:
-left nnn
和
-top nnn
哪个位置的左上角的输出空间提供,取决于您的屏幕大小。
https://stackoverflow.com/questions/72989696
复制相似问题