英文:
Force WinForm Application on top Windows 10 Tablet Mode
问题
Is there any way to force a simple winforms application to run on top the tablet mode main screen?
有没有办法强制一个简单的WinForms应用程序在平板模式主屏幕上运行?
It can be Vb script or anything, the idea is to show a countdown application on top of the main screen to announce the upcoming "force shutdown" of that tablet.
可以使用VB脚本或其他方式,想法是在主屏幕上显示一个倒计时应用程序,以宣布即将进行的平板电脑的“强制关机”。
英文:
Is there any way to force a simple winforms application to run on top the tablet mode main screen ?
It can be Vb script or anything, the idea is to show a count down application on top the main screen to announce the upcoming "force shutdown" of that tablet.
答案1
得分: 0
在平板模式下,你的应用程序将会以“最小化”形式在任务栏中启动,因此你将无法看到它,只能看到“主屏幕”。
对我有效的方法是在我的 Form_Load
事件中添加 SendKey
函数,使用<kbd>alt</kbd> + <kbd>tab</kbd>。
这个方法,与@EpicKip在上面提到的方法结合使用,将始终发送应用程序(即使在“平板模式”的启动屏幕上以及应用程序处于“最小化”状态)。
private void form1_Load(object sender, EventArgs e)
{
//SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
Thread.Sleep(1000);
SendKeys.SendWait(""%{TAB}"");
}
英文:
Whoever face the same problem, there is a "hack" I was reading about.
When on tablet mode, your application will be start as "minimized" in the taskbar, therefore you will not be able to see it, just a "Home screen".
What worked for me was adding to my Form_Load
event the SendKey
Function, with <kbd>alt</kbd> + <kbd>tab</kbd>.
That, mixing with @EpicKip answer just above, will always send the app (even when on start screen of "Tablet Mode" and the app on "Minimized").
private void form1_Load(object sender, EventArgs e)
{
//SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
Thread.Sleep(1000);
SendKeys.SendWait("%{TAB}");
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论