What determines the monitor my app runs on?

前端 未结 11 908
Happy的楠姐
Happy的楠姐 2021-01-30 04:48

I am using Windows, and I have two monitors.

Some applications will always start on my primary monitor, no matter where they were when I closed them.

Ot

11条回答
  •  半阙折子戏
    2021-01-30 05:35

    I've noticed that if I put a shortcut on my desktop on one screen the launched application may appear on that screen (if that app doesn't reposition itself).

    This also applies to running things from Windows Explorer - if Explorer is on one screen the launched application will pick that monitor to use.

    Again - I think this is when the launching application specifies the default (windows managed) position. Most applications seem to override this default behavior in some way.

    A simple window created like so will do this:

    hWnd = CreateWindow(windowClass, windowTitle, WS_VISIBLE | WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, SW_SHOW, CW_USEDEFAULT, 0, NULL, NULL, hInst, NULL);

提交回复
热议问题