在编写DirectX应用程序时,显然需要支持用户暂停应用程序Alt- Tab以一种快速且无错误的方式.确保这一点的最佳做法是什么?需要解决的问题包括:
有趣的技巧和陷阱也很好听.
我的应用程序已经有一种模式多年,客户可以"禁用对操作系统的访问".显然这个功能与谷物相悖(至少就Windows而言),但有些安装我的应用程序是唯一一个应该可见的机器操作员程序,在这种情况下这样的功能是有用的.
我使用的技术是从几个"层"构建的:
要禁用我使用的任务栏:
// Get a handle to the taskbar and its button..
Taskbar := FindWindow('Shell_TrayWnd', Nil);
StartButton := FindWindow('Button', Nil);
// Hide the taskbar and button
if Taskbar <> 0 then
ShowWindow( Taskbar, SW_HIDE );
if StartButton <> 0 then
ShowWindow( StartButton, SW_HIDE );
// Set the work area to the whole screen
R := Rect( 0,0,Screen.Width,Screen.Height );
SystemParametersInfo(
SPI_SETWORKAREA,
0,
@R,
0 );
Run Code Online (Sandbox Code Playgroud)
这很好用,但在W7上似乎还算不错.研究如何在几年前禁用任务切换发现了唯一一种"假装"你的应用程序是屏幕保护程序的技术(除了将应用程序重命名为'explorer.exe'并启动它等等)之外的其他方法:
procedure EnableTaskSwitching( AState : boolean );
// Enables / disables task …Run Code Online (Sandbox Code Playgroud) 如果您使用带3D触控的iPhone稳固地按下屏幕的左边缘,您将调出任务切换器.
我想知道如何在我的应用中禁用此行为.
本文档:防止敏感信息出现在任务切换器中,它描述了一种在applicationDidEnterBackground中显示视图控制器的方法,以便在任务切换器中隐藏关键信息:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Your application can present a full screen modal view controller to
// cover its contents when it moves into the background. If your
// application requires a password unlock when it retuns to the
// foreground, present your lock screen or authentication view controller here.
UIViewController *blankViewController = [UIViewController new];
blankViewController.view.backgroundColor = [UIColor blackColor];
// Pass NO for the animated parameter. Any animation will not complete
// before the snapshot is taken. …Run Code Online (Sandbox Code Playgroud)