在不同的桌面上显示一个窗口 [英] Showing a window on different desktop

查看:94
本文介绍了在不同的桌面上显示一个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个问题。

我有一个应用程序,它在另一个桌面上显示一个全屏窗口。问题是当桌面切换到显示对话框时,新桌面背景会暂时显示,然后只显示全屏窗口。

I have an application which shows a full screen window in a different desktop. The issue is when the desktop is switched to show the dialog, the new desktop background is visible for a moment and then only the full screen window is showing.

问题1:

我的代码类似于下面的代码段。这是切换桌面的正确方法吗?

My code is similar to below code snippet. Is this correct way to switch desktop?

if( !::SetThreadDesktop(hNewDesk))
 {
    LogError( "SetThreadDesktop() failed" );
	return;
 }
 if (!::SwitchDesktop(hNewDesk))
  {
    LogError( "SwitchDesktop() failed" );
    return;
 }

问题2:

我知道如何以不同的方式启动应用程序桌面使用CreateProcess()而不切换到那个桌面。我想在另一个桌面上创建一个窗口而不切换到那个桌面。例如桌面1和桌面2.我想在桌面2中从桌面创建完整的
屏幕窗口1,无需切换到桌面2,以便在调用SwitchDesktop()时桌面2中已显示该窗口。任何人都可以帮我这个吗?

I know how to start an application in a different desktop using CreateProcess() without switching to that Desktop.I wanted to create a Window in another desktop without switching to that desktop.For example Desktop 1 and Desktop 2. I wanted to create full screen window in Desktop 2 from Desktop 1 without switching to Desktop 2 so that the window is already visible in Desktop 2 when SwitchDesktop() is called. Could anyone help me in this?










谢谢,Renjith VR

Thanks, Renjith V R

推荐答案

问题1:

您只能使用SwitchDesktop()来更改桌面。除非您希望当前线程使用切换桌面,否则无需调用SetThreadDesktop()。

You can use SwitchDesktop() only to change desktops. There is no need to call SetThreadDesktop() unless you want the current thread to use the switched desktop.

问题2:

我认为最简单答案是在目标桌面上启动一个应用程序,让该应用程序为您绘制窗口 代表你。我看到的唯一问题是你不知道这需要多长时间。

I think the easiest answer is to launch an application in the target desktop and let that application draw the window for you  on your behalf. The only issue I see is that you won't know how long this will take.

如果你想使用当前桌面上的程序在目标桌面上绘制一个窗口,那么你在打开窗口或启动消息泵的任何调用之前,需要调用SetThreadDesktop()
Thi s
需要在您的计划中尽早完成。

If you want to draw a window in the target desktop using the program in the current desktop, then you do need to call SetThreadDesktop() before any call that opens a window or starts a message pump. This needs to be done very early in your program.

我很好奇你是什么问题试图解决。你为什么一开始使用桌面?

I'm curious what problem you are trying to solve. Why are you using a desktop in the first place?


这篇关于在不同的桌面上显示一个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆