0

リモート デスクトップを使用して、Windows XP Professional SP3 と 1 つの画面を備えたラップトップから、2 つのモニターを備えた Windows 7 Professional を実行しているリモート PC に接続しています。

ラップトップの解像度は約 1024x768 で、リモート PC の各モニターは約 1600x900 です。

リモート デスクトップ セッションを開始する前に、Windows 7 PC の 2 番目のモニターのすべてのウィンドウを最初のモニターに移動します。(ラップトップとPCの両方が同じオフィスエリアにあります。)

リモート デスクトップ セッションは機能しますが、ラップトップでセッションを終了し、リモートの Windows 7 PC での作業に戻った後、元の配置に戻すには通常、多くのウィンドウの位置を変更してサイズを変更する必要があります。

現在の構成で、上記の「再配置とサイズ変更」の手順を回避するにはどうすればよいですか?

ラップトップに Windows 7 Professional が搭載されていた場合、この問題の解決に役立ちますか?

4

1 に答える 1

0

おそらくこれをスーパーユーザーに移動する必要がありますが、StackOverflowで質問したので、説明したことを実行するプログラムを実装できます.

擬似コード:

class WindowPosition {
    IntPtr hWnd;
    RECT Location;
}

List<WindowPosition> positions = null;

void OnCaptureWindowPositionHotkey() {
    positions = new List<WindowPosition>();
    EnumWindows(enumStoreWindows, null);
}

void OnResetWindowPositionHotkey() {
    EnumWindows(enumStoreWindows, null);
}

void enumSetWindows(IntPtr hwnd, IntPtr obj) {
    positions.Add(new WindowPosition() {
        hWnd = hwnd,
        Location = GetWndLocation(hwnd)
    };
}

RECT GetWndLocation(IntPtr hwnd) {
    RECT outrect = null;
    GetWindowRect(hwnd, out outrect);
    return outrect;
}

void enumSetWindows(IntPtr hwnd, IntPtr obj) {
    var loc = (from wl in positions
              where wl.hWnd == hwnd
              select wl).FirstOrDefault();
    if (loc == null) return;
    SetWindowPos(hwnd, null, 
        loc.Location.X,
        loc.Location.Y,
        loc.Location.Width,
        loc.Location.Height,
        0);
}

ここでEnumWindowsSetWindowPosGetWindowRectはすべて Win32 関数です。参照 : http://msdn.microsoft.com/en-us/library/windows/desktop/ms633497(v=vs.85).aspx、http://msdn.microsoft.com/en-us/library/windows _ /desktop/ms633545(v=vs.85).aspx、およびhttp://msdn.microsoft.com/en-us/library/windows/desktop/ms633519(v=vs.85).aspx

于 2012-11-11T03:24:20.973 に答える