5

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 and 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 Application

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

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.

sha
  • 17,824
  • 5
  • 63
  • 98

2 Answers2

5

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;
Tom van Enckevort
  • 4,170
  • 1
  • 25
  • 40
  • I was trying to avoid _this_ solution. Because in this case I need to take care about network and battery indicator and probably draw whole title by myself. And it would require major refactoring of existing application. – sha Mar 29 '11 at 12:53
  • 1
    I actually think that half of your solution would satisfy me :) I did FindWindow/EnableWindow and it works pretty well. User loses all access to title bar - which has some downside but still acceptable. Thank you for pointing in right direction. – sha Mar 29 '11 at 14:42
  • Ah, that would indeed work for you. Glad to have been able to help out. – Tom van Enckevort Mar 29 '11 at 14:52
0

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);
dkackman
  • 15,179
  • 13
  • 69
  • 123
  • Is your form set to borderless, topmost, without a control box and minimizebox? – dkackman Mar 29 '11 at 12:55
  • Yes. It does: this.MaximizeBox = false; this.ControlBox = false; this.MinimizeBox = false; this.TopMost = true; this.FormBorderStyle = FormBorderStyle.None; – sha Mar 29 '11 at 12:59
  • Looking at some old code i've got (worked on CE 6) I have a BringToFront() at the bottom of my OnLoad method after the call to SHFullScreen. Try that too. – dkackman Mar 29 '11 at 13:15
  • I have that too. Problem with all this - I need to call this function constantly not only in OnLoad. Because pretty much any click on control will restore previous conditions. And unfortunately none of it would do anything with strange title bar behavior - it's just something new Microsoft added in 6.5 I guess... – sha Mar 29 '11 at 13:21
  • Unfrotunately I'm our of ideas then. Good luck. – dkackman Mar 29 '11 at 13:24
  • 1
    I did find this thread which may be helpful http://social.msdn.microsoft.com/Forums/en/netfxcompact/thread/35ae59c9-4f1e-4a8e-bfd9-8d8fb6a25cc1 – dkackman Mar 29 '11 at 13:30