Taggert

Hello,
I know that I am not the first asking the question about running a PDA in kiosk mode.

What I did by now is to disable the taskbar by running the following line of code

[DllImport("coredll.dll")]
public static extern int ShowWindow(int hwnd, int nTaskShow);

The goals was to disable the start-button by hiding the taskbar. This didn't work out (otherwise I would not write this post...)

Then I found something about the SHFullScreen command and the way to use the SHFS_HIDESTARTICON parameter. This command was compiling and I could test it on the PDA however the start-button still was there and if you hit it quit often in a short timespan the whole PDA software crashed. So I might have done something wrong.

So I wonder - has the SHFullScreen command the ability to disable the start-button and if so can you give me a few lines of code, please.

I checked out the whole forum and I couldn't find someting that worked out well for me - also nothing on the OpenNETCF Forum. So if you pls drop a few lines of code for me I'd be very grateful.

Thank you very much
Greetings Taggert


Re: Smart Devices VB and C# Projects Disable start-button to get into kiosk

Michael Koster

Hi Taggert

You should find a couple of posts dealing with this kind of question. Try searching all Smart Device Forum questions for 'SHFullScreen'
The following search returns a good number of answers that sould help fix your problem http://forums.microsoft.com/MSDN/Search/Search.aspx words=SHFullScreen+&localechoice=9&SiteID=1&searchscope=forumgroupscope&ForumGroupID=11)

Michael






Re: Smart Devices VB and C# Projects Disable start-button to get into kiosk

Taggert

Hi Michael,

thanks for your reply. Unfortunately I already did that. The result was that the taskbar was still visible however the system crashed when I was pressing the windows button around three times in a row. Therefor I hoped to get a few lines.

By now I tried a different approach. I tried to access the buttons with some classes I found here
http://www.opennetcf.org/forums/topic.asp TOPIC_ID=283

The problem is that this program works fine for most of the buttons - just not for the windows /start button. So I digged a little deeper and I found out that the windows button is not within the registry (at least not where the other three buttons are).

So if you have any good idea that might help me with that problem - I am anxious to try it out.
Thank you very much for your support

I also worked on the SHFullScreen Solution - however it doesn't work out for me.  Its not crashing anymore (this was due to the HideTaskbar function, which I deleted), however when I try my code it the taskbar is always up to the very front of the application and I don't know why. Therefor I posted my application in the next thread.  Please have a glance at it - I just have no clue where the mistake might be.  Thank you very much.

Keep up the good work
Greetings Taggert




Re: Smart Devices VB and C# Projects Disable start-button to get into kiosk

Taggert

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;

namespace Hello_World
{
public partial class StartForm : Form
{
private Timer timer;
public StartForm()
{

InitializeComponent();
IntPtr hWnd = API.FindWindow(this.Text);
if (hWnd != IntPtr.Zero)
{
System.Diagnostics.Debug.WriteLine("hWnd ist nicht null");
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Focus();

SHAPI.SetForegroundWindow(hWnd);
SHAPI.FullScreen(hWnd);
}
}
}

public class API
{
[DllImport("coredll.dll", EntryPoint = "FindWindow")]
private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);

public static IntPtr FindWindow(string windowName)
{
return FindWindow(null, windowName);
}
}

public class SHAPI
{
public const int SHFS_SHOWTASKBAR = 1;
public const int SHFS_HIDETASKBAR = 2;
public const int SHFS_SHOWSIPBUTTON = 4;
public const int SHFS_HIDESIPBUTTON = 8;
public const int SHFS_SHOWSTARTICON = 16;
public const int SHFS_HIDESTARTICON = 32;

[DllImport("aygshell.dll")]
private extern static bool SHFullScreen(IntPtr hWnd, int dwState);

public static bool FullScreen(IntPtr hWnd)
{
return SHFullScreen(hWnd, SHFS_HIDESTARTICON | SHFS_HIDETASKBAR);
}

[DllImport("coredll.dll")]
internal static extern int SetForegroundWindow(IntPtr hWnd);
}
}




Re: Smart Devices VB and C# Projects Disable start-button to get into kiosk

Michael Koster

The following sample hides only the start menu but leaves the rest visible:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;

namespace Wm5ppc
{
public partial class Form1 : Form
{
public Form1 ()
{
InitializeComponent ();
this.MinimizeBox = false;
}
private void Form1_Activated (object sender, EventArgs e)
{

IntPtr hWnd = this.Handle;
SHAPI.FullScreen (hWnd);
}
}

public class SHAPI
{
public const int SHFS_SHOWTASKBAR = 1;
public const int SHFS_HIDETASKBAR = 2;
public const int SHFS_SHOWSIPBUTTON = 4;
public const int SHFS_HIDESIPBUTTON = 8;
public const int SHFS_SHOWSTARTICON = 16;
public const int SHFS_HIDESTARTICON = 32;
[DllImport ("aygshell.dll")]
private extern static bool SHFullScreen (IntPtr hWnd, int dwState);

public static bool FullScreen (IntPtr hWnd)
{
return SHFullScreen (hWnd, SHFS_HIDESTARTICON);
}
}
}

If you want a real 'full screen' application set the form property Form.WindowState to Maximized. To get rid of the main menu - simply remove the mainMenu1 component from the form.






Re: Smart Devices VB and C# Projects Disable start-button to get into kiosk

Taggert

Hi Michael,

thank you very much for your support. It seems that it is gonna work now. You really saved my day. In fact I was working on that problem for several days (weeks) and even the manufacturer of the device could only offer a solution with the GAPI for Mobile 2003.

Thanks a lot - this was the first time for me I really needed some serious help and you did your job excellent. I hope you don't mind sending the link of this thread to the manufacturer, so he can give better adivce now.

I wish you a very nice week and again - you saved my day.
Thank you Michael

Greetings Taggert





Re: Smart Devices VB and C# Projects Disable start-button to get into kiosk

Anarchy

Taggert, there are many traps to fall into trying to make a PPC app fullscreen or in kiosk mode.

1. If you turn on the SIP, from the options you can get access to the start menu

2. If you receive a fone call, it will pop over your app, and give access to the start menu...

3. hard buttons will open an app with access... etc

I think if you really want to lock out everything else, you'll need a timer to check the title of the foreground app, and if it isn't your app, bring your app to the front

good luck!