How to open an application window while there is another application active in fullscreen mode in Windows?

三世轮回 提交于 2019-12-13 05:27:01

问题


My scenario is the following:

The user of my WPF Windows application won't be using it very often. Instead, he will be most of time using another application in fullscreen mode, sometimes it being an ERP system. Many of these users will be cash attendants in groceries, and that's why they will have a fullscreen application active most of the time in their machines.

While these users are making sales, depending on the buyer, they will have to access my application to confirm some information about the buyer, but my application will not be integrated with the seller application in any way. The user will be responsible from switching to my application and them coming back to his main application again.

But since the user's main application will sometimes be active in fullscreen mode, I need to make sure that he will be able to open my application, without closing the fullscreen application. It would be even best if the main application stay visible on screen while the user opens my application, uses it and then minimize it again.

This will be a continuous proccess that will be being executed through all working day of the user. So the user will be allways with both of the application open: mine and his main app, switching to my application only when he needs to, but with his app always in fullscreen mode.

Sorry if the question is not very clear to understand, I can try to explain it better in the comments if necessary. Thank you for your help!


回答1:


window.TopMost = true; // this will make the window top most
window.Activate();

A combination of these two shoud do it I think. You can also handle the deactivate event and activate your window again ... something like this:

private void Window_Deactivated(object sender, EventArgs e)
{
    Window window = (Window)sender;
    window.TopMost = true;
    window.Activate();
}


来源:https://stackoverflow.com/questions/25646901/how-to-open-an-application-window-while-there-is-another-application-active-in-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!