1

I have 2 monitors with different resolution and scaling:

  1. 2560 * 1440 scaling x1 (Primary)

  2. 1920 * 1200 scaling x1.5 (to the left from primary [2][1] aligned to top)

My application is changing position of another app window. The window I try to set location has dimensions 300x200. I set window location to (-150|200) and in the very next row check the location:

::SetWindowPos(this->handle, 0, lLeft, lTop, 0,0, SWP_NOREPOSITION | SWP_NOSIZE);
// output lLeft, lTop
RECT r = { 0 };
::GetWindowRect(this->handle, &r);
// output r.left, r.top

And I have following output:

<< -150  200 // SetWindowPos
>> -740  133 // GetWindowRect

After positioning the window has scaling 1 (from primary) while is located on secondary and should have scaling 1.5

It misplaces the window with x = [-150 ... 0]

It looks like this happens when the window is partially on secondary monitor and the middle point of the window already on primary monitor.

Is there anything I can do to avoid such behavior?

htonus
  • 469
  • 1
  • 6
  • 17
  • https://docs.microsoft.com/en-us/windows/desktop/hidpi/wm-dpichanged – Hans Passant Dec 11 '18 at 14:45
  • Not sure how to use it. I added manifest to my application https://bpaste.net/show/df81df0fffa8 and calculate proper width/height and position on every monitor according to scaling. But Windows still does bitmap stretching. If I drag notepad spawned from Start Menu - all is okay. But if I spawn notepad with CreateProcessA - bitmap stretching. – htonus Dec 13 '18 at 07:52

0 Answers0