| 1055 |
HMONITOR hMonitor; |
HMONITOR hMonitor; |
| 1056 |
MONITORINFO mi; |
MONITORINFO mi; |
| 1057 |
int stat = SW_RESTORE; |
int stat = SW_RESTORE; |
| 1058 |
|
OSVERSIONINFO osvi; |
| 1059 |
|
int multi_mon = 0; |
| 1060 |
|
|
| 1061 |
|
// Windowsのバージョンを取得する。 |
| 1062 |
|
// なお、Windows8.1では、GetVersionEx()はdeprecated APIであるため、Windows8(major=6,minor=2) |
| 1063 |
|
// と返ってくる。Manifestファイルを修正するという回避方法があるようだが、Visual Studio 2005では |
| 1064 |
|
// 使えないものと思われる。 |
| 1065 |
|
// cf. http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx |
| 1066 |
|
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
| 1067 |
|
GetVersionEx(&osvi); |
| 1068 |
|
if ( (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion == 4) || |
| 1069 |
|
(osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && osvi.dwMinorVersion < 10) ) { |
| 1070 |
|
multi_mon = 0; |
| 1071 |
|
} else { |
| 1072 |
|
multi_mon = 1; |
| 1073 |
|
} |
| 1074 |
|
|
| 1075 |
// 一度、復元したらフラグは落とす。 |
// 一度、復元したらフラグは落とす。 |
| 1076 |
pm->WinUndoFlag = FALSE; |
pm->WinUndoFlag = FALSE; |
| 1082 |
if (stat == SW_RESTORE && memcmp(&pm->WinPrevRect[i], &rc0, sizeof(rc0)) != 0) { |
if (stat == SW_RESTORE && memcmp(&pm->WinPrevRect[i], &rc0, sizeof(rc0)) != 0) { |
| 1083 |
rc = pm->WinPrevRect[i].rcNormalPosition; |
rc = pm->WinPrevRect[i].rcNormalPosition; |
| 1084 |
|
|
| 1085 |
// 対象モニタの情報を取得 |
// NT4.0, 95 はマルチモニタAPIに非対応 |
| 1086 |
hMonitor = MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST); |
if (multi_mon) { |
| 1087 |
mi.cbSize = sizeof(MONITORINFO); |
// 対象モニタの情報を取得 |
| 1088 |
GetMonitorInfo(hMonitor, &mi); |
hMonitor = MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST); |
| 1089 |
|
mi.cbSize = sizeof(MONITORINFO); |
| 1090 |
// 位置補正(復元前後で解像度が変わっている場合への対策) |
GetMonitorInfo(hMonitor, &mi); |
| 1091 |
if (rc.right > mi.rcMonitor.right) { |
|
| 1092 |
rc.left -= rc.right - mi.rcMonitor.right; |
// 位置補正(復元前後で解像度が変わっている場合への対策) |
| 1093 |
rc.right = mi.rcMonitor.right; |
if (rc.right > mi.rcMonitor.right) { |
| 1094 |
} |
rc.left -= rc.right - mi.rcMonitor.right; |
| 1095 |
if (rc.left < mi.rcMonitor.left) { |
rc.right = mi.rcMonitor.right; |
| 1096 |
rc.right += mi.rcMonitor.left - rc.left; |
} |
| 1097 |
rc.left = mi.rcMonitor.left; |
if (rc.left < mi.rcMonitor.left) { |
| 1098 |
} |
rc.right += mi.rcMonitor.left - rc.left; |
| 1099 |
if (rc.bottom > mi.rcMonitor.bottom) { |
rc.left = mi.rcMonitor.left; |
| 1100 |
rc.top -= rc.bottom - mi.rcMonitor.bottom; |
} |
| 1101 |
rc.bottom = mi.rcMonitor.bottom; |
if (rc.bottom > mi.rcMonitor.bottom) { |
| 1102 |
} |
rc.top -= rc.bottom - mi.rcMonitor.bottom; |
| 1103 |
if (rc.top < mi.rcMonitor.top) { |
rc.bottom = mi.rcMonitor.bottom; |
| 1104 |
rc.bottom += mi.rcMonitor.top - rc.top; |
} |
| 1105 |
rc.top = mi.rcMonitor.top; |
if (rc.top < mi.rcMonitor.top) { |
| 1106 |
|
rc.bottom += mi.rcMonitor.top - rc.top; |
| 1107 |
|
rc.top = mi.rcMonitor.top; |
| 1108 |
|
} |
| 1109 |
} |
} |
| 1110 |
|
|
| 1111 |
// ウィンドウ位置復元 |
// ウィンドウ位置復元 |