Hi Sandip, Thank you very much for your so nice help. I tried the code above, but it still doesn't work. I debugged it. rect.left is -2200, rect.right is -786. Does it mean the parent lies in the secondary display? I set the secondary display as in the left side, and the primary display in the right side. The strange thing is that whatever I do, the pop up window is always in the primary display, the same position. Best regards,
logiqworks
Posts
-
Dual monitor, pop up window goes to primary display -
Dual monitor, pop up window goes to primary displayHi Sandip, The situation is that the parent window is initially generated in primary display. I drag it to the secondary display. Then do some operations and pop up some windows. And the pop up window will go back the primary display. I tried wnd->CreateEx(menuAlwaysOnTop ? (WS_EX_TOPMOST | WS_EX_TOOLWINDOW) : WS_EX_TOOLWINDOW, AfxRegisterWndClass(CS_NOCLOSE), "MenuWindow", WS_POPUP, rect, AfxGetMainWnd(), 0, NULL); wnd->CenterWindow(AfxGetMainWnd()); as you said. But the pop up window is still in the primary display. And it doesn't locate in the center of the window.
-
Dual monitor, pop up window goes to primary displayHi Vishal, Could you please give me a hint how to do in "Display Driver"? I never use it. But I would like to try.
-
Dual monitor, pop up window goes to primary displayDo you mean to pass only parent like this: wnd->CenterWindow(parent); The parent is one child of main window. Because it is complicated to get the main window, so I just use one child window.
-
Dual monitor, pop up window goes to primary displayHi Sandip, I tried CenterWindow(GetParent()). But it doesn't work. The pop up window is still in the primary display, while the main application window is in the secondary display. I do it in this way: wnd->CreateEx(menuAlwaysOnTop ? (WS_EX_TOPMOST | WS_EX_TOOLWINDOW) : WS_EX_TOOLWINDOW, AfxRegisterWndClass(CS_NOCLOSE), "MenuWindow", WS_POPUP, rect, parent, 0, NULL); wnd->CenterWindow(parent->GetParent()); Does it mean the "parent" is not the real main window? or CenterWindow() doesn't work? Actually the position of the pop up window is same as before. Best,
-
Dual monitor, pop up window goes to primary displayHi Sandip, Thank you very much for your tip. I will try the ways as you said. Here I would like to clarify my question again: actually I found many applications have this problem same as mein. For example, Outlook, if you configure your system as dual monitor, start Outlook, drag the outlook to the secondary display, then click compose new email. You will see the new email composing window pops to the primary display. But an opposite example is Visual Studio. If you do the same thing for Visual studio, click open file button, the new dialog sticks same with the main visual studio window.
-
Dual monitor, pop up window goes to primary displayHi, I have one application, which should use pop up window. If I configer the system as dual monitor, drag the application to the secondary display, then click the button to pop up the window, the window will go to the primary display. In the source code, the pop up window is created by: wnd->CreateEx(menuAlwaysOnTop ? (WS_EX_TOPMOST | WS_EX_TOOLWINDOW) : WS_EX_TOOLWINDOW, AfxRegisterWndClass(CS_NOCLOSE), "MenuWindow", WS_POPUP, rect, NULL, 0, NULL); I tried to change it to wnd->CreateEx(menuAlwaysOnTop ? (WS_EX_TOPMOST | WS_EX_TOOLWINDOW) : WS_EX_TOOLWINDOW, AfxRegisterWndClass(CS_NOCLOSE), "MenuWindow", WS_POPUP, rect, parent, 0, NULL); Changed the last third parameter from NULL to parent, which is the main application window. But the pop up window is still go to the primary display. How can I figure it out? Thanks in advance!