开发者

Disable menu bar in Windows Mobile 6.5

开发者 https://www.devze.com 2023-02-20 17:18 出处:网络
I\'m porting .NET application from WM5 to WM6.5. Besides new resolution I noticed different UI behavior for start menu and title bar (caption bar). My application needs to work in kind of kiosk mode w

I'm porting .NET application from WM5 to WM6.5. Besides new resolution I noticed different UI behavior for start menu and title bar (caption bar). My application needs to work in kind of kiosk mode where user can't exit application an开发者_如何学编程d bypass our authentication. For this purpose on WM5 I was hiding start button and close button. I am using following function:

SHFullScreen(hWnd, SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON); 

Hiding buttons kind of works on WM6.5 too, but there is another problem. User can tap on the title bar (menu bar, caption bar - I'm not sure what is proper name for it - the bar on the top of the screen) and get access to Windows Task Manager. See attached screenshot

Disable menu bar in Windows Mobile 6.5

I cirlced places where user can tap and get out to Task Manager like this:

Disable menu bar in Windows Mobile 6.5

Any ideas how to disable that interaction? Device is Motorola MC65. Running Windows Mobile 6.5.

So, the final answer is part of an answer posted below:

IntPtr tWnd = FindWindow("HHTaskBar", null);
EnableWindow(tWnd, false);

We just find the HHTaskBar and disable it. It has some downside, but overall does the trick.


You can hide the whole top taskbar and maximize your form:

// the following three lines are p/invoked
IntPtr tWnd = FindWindow("HHTaskBar", null);
EnableWindow(tWnd, false);
ShowWindow(tWnd, SW_HIDE);

// maximize your form
form.Size = new Size(240, 320); // or whatever the device's screen dimensions are
form.WindowState = FormWindowState.Maximized;


Try the method SHFullScreen with SHFS_HIDETASKBAR which is described this way on MSDN:

Put the taskbar at the bottom of the z-order. Note that a game or an application that requires the entire screen may use this flag. Be sure that your application is sized to full screen before using this flag. Otherwise, it will appear as though the function did nothing.

protected override void OnLoad(EventArgs e)
{
    ...

    SHFullScreen(this.Handle, SHFS_HIDETASKBAR | 
        SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON);

    base.OnLoad(e);
}

private const int SHFS_SHOWTASKBAR = 0x0001;
private const int SHFS_HIDETASKBAR = 0x0002;
private const int SHFS_SHOWSIPBUTTON = 0x0004;
private const int SHFS_HIDESIPBUTTON = 0x0008;
private const int SHFS_SHOWSTARTICON = 0x0010;
private const int SHFS_HIDESTARTICON = 0x0020;

[DllImport("aygshell")]
static extern bool SHFullScreen(IntPtr hwnd, int dwState);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号