Force WinForm Application on top Windows 10 Tablet Mode

huangapple go评论47阅读模式
英文:

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.

screnshot

答案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("&quot;%{TAB}&quot;");
}
英文:

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(&quot;%{TAB}&quot;);
}

huangapple
  • 本文由 发表于 2023年2月14日 06:05:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75441649.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定