P
P
Pavel Kaptur2016-11-30 14:27:28
C++ / C#
Pavel Kaptur, 2016-11-30 14:27:28

Why is the window drawn to the left and higher than it should?

Hello everyone, I have such a question, I create a window for my program and I want it to appear above the start menu from the bottom right, size 480 * 320, I wrote the code

SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkAreaSize, 0);

  UINT xWindowsSize = 480;
  UINT yWindowsSize = 320;

  UINT yPosition = WorkAreaSize.bottom - WorkAreaSize.top - yWindowsSize;
  UINT xPosition = WorkAreaSize.right - WorkAreaSize.left - xWindowsSize;
  HWND hWnd = CreateWindow(THIS_CLASSNAME, TEXT("Title"), WS_SYSMENU | WS_CAPTION, 
        xPosition, yPosition, xWindowsSize, yWindowsSize, NULL, NULL, hInst, NULL);
  if (!hWnd) {
    MessageBox(NULL, L"Can't create window!", TEXT("Warning!"), MB_ICONERROR | MB_OK | MB_TOPMOST);
    return 1;
  }

so that the window appears where I want, but it appears 7 pixels higher and to the left than I need? why? I run on Windows 10, there is no way to check on others

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kalapanga, 2016-11-30
@kalapanga

In 10, there is a transparent frame around the window, like just 7 pixels each. Now I’m not sitting at the 10th, but in my opinion if you take a screenshot of the active window, then the window will get into the picture and a little more from all sides. Here it is (transparent frame) is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question