提问人: 提问时间:5/20/2019 更新时间:5/20/2019 访问量:204
MoveWindow 在 DeSmuME 的窗口上不做任何事情
MoveWindow doesn't do anything on DeSmuME's Window
问:
我对 DeSmuME 的进程进行了基本测试,它根本没有导致任何变化,我至少期望它的 X/Y pos 更改为 0(屏幕左上角),但不,什么都没有,奇怪的是它得到了手柄,RECT 结构也适用于它,它设法让位置很好。MoveWindow(handle, 0, 0, 1280, 720, true)
[StructLayout(LayoutKind.Sequential)]
public struct RECT {
public int left;
public int top;
public int right;
public int bottom;
}
[DllImport("user32.dll", SetLastError = true)]
static extern bool GetWindowRect(IntPtr hWnd, ref RECT Rect);
[DllImport("user32.dll", SetLastError = true)]
static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int Width, int Height, bool Repaint);
static void Main(string[] args) {
Process[] processes = Process.GetProcessesByName("DeSmuME_X432R_x64");
foreach (Process p in processes) {
IntPtr handle = p.MainWindowHandle;
RECT Rect = new RECT();
if (GetWindowRect(handle, ref Rect)) {
MoveWindow(handle, 0, 0, 1280, 720, true);
}
Console.WriteLine(Rect.right);
Console.ReadLine();
}
}
答: 暂无答案
评论
MoveWindow