Can't get rid of that task bar

E

Erwin Burgstaller

Playing around with having a kiosk mode application on Pocket-PC, I always
end up with the task bar doesn't hide and is always on top.

I'm working with Visual Studio 8, C# and .NET 2.0. For testing I have a
Symbol PT-8800 and the emulated Pocket PC 2003.

First I've tried to maximize my form with code like this:

private void Form1_Load(object sender, System.EventArgs e)
{
// menu = null;
FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
}

Maximize does work, but the taskbar is not covered. It's hiding the top of
my form.

Next I've found that example code which is working with SHFullScreen().
Which hides the start icon with SHFS_HIDESTARTICON for some time, but
SHFS_HIDETASKBAR doesn't work. The input options menu on the right bottom
disappears too but only when SHFS_HIDETASKBAR is set, on the other hand
SHFS_HIDESIPBUTTON is ignored too. But anyway SHFullScreen is not the
solution I'm looking for, first it's not .NET (so far as I understand) and
second it will not work on CE Clients. Latter I cannot verify, 'cause "CE
4.2" will not work with .NET 2.0 and I don't have a "CE 5" emulation, but
that's another story.

So, how do I get a kiosk mode application in pure .NET and C#?

Erwin
 
P

Paul Bilnoski

Erwin said:
Playing around with having a kiosk mode application on Pocket-PC, I always
end up with the task bar doesn't hide and is always on top.

I'm working with Visual Studio 8, C# and .NET 2.0. For testing I have a
Symbol PT-8800 and the emulated Pocket PC 2003.

First I've tried to maximize my form with code like this:

private void Form1_Load(object sender, System.EventArgs e)
{
// menu = null;
FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
}

Maximize does work, but the taskbar is not covered. It's hiding the top of
my form.

Next I've found that example code which is working with SHFullScreen().
Which hides the start icon with SHFS_HIDESTARTICON for some time, but
SHFS_HIDETASKBAR doesn't work. The input options menu on the right bottom
disappears too but only when SHFS_HIDETASKBAR is set, on the other hand
SHFS_HIDESIPBUTTON is ignored too. But anyway SHFullScreen is not the
solution I'm looking for, first it's not .NET (so far as I understand) and
second it will not work on CE Clients. Latter I cannot verify, 'cause "CE
4.2" will not work with .NET 2.0 and I don't have a "CE 5" emulation, but
that's another story.

So, how do I get a kiosk mode application in pure .NET and C#?

Erwin

I used OpenNETCF and got it to work with these, called in the form's
Load event handler.
where W32 = OpenNETCF.Win32 and WIN = OpenNETCF.Win32.Win32Window
and using an accessible variable for the screen size of my device:
System.Drawing.Size WindowSize = new System.Drawing.Size(324,324);

/// <summary>
/// To be called on a form load event. Sets the form given to be
topmost and over the
/// standard Windows taskbar. Same as calling SetTopmost(f, false).
/// </summary>
public static bool SetTopmost(System.Windows.Forms.Form f)
{
if (f == null)
return false;
return SetTopmost(f, false);
}

/// <summary>
/// To be called on a form load event. Sets the form given to be
topmost and over the
/// standard Windows taskbar.
/// </summary>
public static bool SetTopmost(System.Windows.Forms.Form f, bool
useFormPosition)
{
if (f == null)
return false;

//get handle
f.Capture = true;
System.IntPtr hwnd = WIN.GetCapture();
f.Capture = false;

int x = useFormPosition ? f.Location.X : 0;
int y = useFormPosition ? f.Location.Y : 0;
int w = useFormPosition ? f.Width : WindowSize.Width;
int h = useFormPosition ? f.Height : WindowSize.Height;

//set foreground
int rv = WIN.SetWindowPos(hwnd,
W32.HWND.TOPMOST,
x, y, w, h,
W32.SWP.SHOWWINDOW);

// returns as a C++ 'BOOL', convert to a C# 'bool'
return rv != 0;
}

--Paul Bilnoski
 
E

Erwin Burgstaller

* Paul Bilnoski said:
I used OpenNETCF and got it to work with these, called in the form's
Load event handler.
where W32 = OpenNETCF.Win32 and WIN = OpenNETCF.Win32.Win32Window
and using an accessible variable for the screen size of my device:
//set foreground
int rv = WIN.SetWindowPos(hwnd,
W32.HWND.TOPMOST,
x, y, w, h,
W32.SWP.SHOWWINDOW);

Hm, so it seems it needs OpenNETCF just for that one call. Might be
cool, if you use OpenNetCF anyway, but I don't and I'd like to avoid
bringing in other software, if it isn't really neccessary. Can't
believe, that there's no better solution.

It simply looks like my devices behave different from what they should
do, as there are examples in the net where just maximizing the form is
believed to do the work. I didn't find anything about, but maybe I miss
something to be configured right?

Erwin
 
P

Paul Bilnoski

Erwin said:
Hm, so it seems it needs OpenNETCF just for that one call. Might be
cool, if you use OpenNetCF anyway, but I don't and I'd like to avoid
bringing in other software, if it isn't really neccessary. Can't
believe, that there's no better solution.

It simply looks like my devices behave different from what they should
do, as there are examples in the net where just maximizing the form is
believed to do the work. I didn't find anything about, but maybe I miss
something to be configured right?

Erwin

I spent a day or two searching for an easy (and free) way to do kiosk
mode, and ended up using this part of OpenNETCF.
Since it's open source, I just use the source files I need and wrap them
into a DLL I already have for my application.
I have since ended up using several other features and expanding the
source used. The footprint is still rather small.

This is how OpenNETCF implements the call, you might be able to recreate
that behavior for your app instead.

[DllImport("coredll.dll", SetLastError=true)]
public extern static int SetWindowPos (
IntPtr hWnd, HWND pos,
int X, int Y, int cx, int cy, SWP uFlags);

TOPMOST is an enum value of -1,
SHOWWINDOW is an enum value of 0x0040

--Paul
 
E

Erwin Burgstaller

Paul Bilnoski said:
[DllImport("coredll.dll", SetLastError=true)]
public extern static int SetWindowPos (
IntPtr hWnd, HWND pos,
int X, int Y, int cx, int cy, SWP uFlags);

TOPMOST is an enum value of -1,
SHOWWINDOW is an enum value of 0x0040

I've tried that too, just after my last post and it didn't work either. So
far I have always the very same result, regardless if I use SetWindowPos,
SHFullScreen or just do it simply with the form's properties.

The current code looks like this:

ControlBox = false;
MinimizeBox = false; // should be obsolete
FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
TopMost = true;

I've noticed, that my fullscreen mode almost is working. After the
application has started, it's possible to launch another application with
the start menu, e.g the calendar. But the calendar program cannot occupy
the screen, because mine is on top. This is except task and menu bar which
are shown from the calendar application.

When I then click to my application it suddenly takes over of the complete
screen, just as I thought it should be right from the start.

But when the device is put to sleep, the calendar application overwrites
task and menu bar again until I click to my application. After that it
becomes full screen again.

It looks like the device doesn't take my form serious.

Erwin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top