hunkydoryrepair / MonitorKeeper

Return windows to their rightful place when changing monitors.
MIT License
233 stars 13 forks source link

Notes : repositioning of windows #7

Closed yuyuishiishi closed 2 years ago

yuyuishiishi commented 2 years ago

it takes a few seconds for My PC to recognizes the 2nd extended display, when coming back from the sleep mode. Therefore sometimes the repositioning of the windows failed in my PC.

In this case, repositioning of windows should be after the PC recognize the 2nd display. in order to achieve this, TimerCallback function should be delayed as below and it worked fine for me.

// // reposition windows after a slight delay VOID CALLBACK TimerCallback( In HWND hwnd, In UINT uMsg, In UINT_PTR idEvent, In DWORD dwTime ) { Sleep(5 * 1000); // Inserted to delay TimerCallback function ProcessMonitors(); KillTimer(hwnd, idEvent); }

hunkydoryrepair commented 2 years ago

did you close this because your solution worked for you? Or was the timer unnecessary after all?

MonitorKeeping watches for the monitors to be recognized and repositions only after the 2nd monitor is detected, so it isn't clear to me why adding a delay would be necessary.