-Chris
"WebJumper" <WebJ...@discussions.microsoft.com> wrote in message
news:3E60D8DB-E0A6-4F2F...@microsoft.com...
> Hi,
>
> I have written an kiosk mode application for my WinCE device.
> After I had problems with threads and GUI, I installed SP3 and this solved
> the problems I had.
> Unfortunately I have now a new problem: The kiosk mode now is not working,
> startbar does not disappear.
>
> I've done the kioskemode with an example from "Sergey Bogdanov", topic
> "Kiosk Mode withou aygshell.dll"
>
> Can anyone help me please?
namespace LaraCE
{
public class cKiosk
{
Form mainForm = null;
private IntPtr _hwnd = IntPtr.Zero;
private IntPtr Hwnd
{
get
{
if (_hwnd == IntPtr.Zero)
{
this.mainForm.Capture = true;
_hwnd = GetCapture();
this.mainForm.Capture = false;
}
return _hwnd;
}
}
public cKiosk (Form _mainForm)
{
if (_mainForm == null)
throw new System.ArgumentNullException();
mainForm = _mainForm;
}
public void Start ()
{
this.mainForm.ControlBox = false;
EnableToolbar(false);
this.mainForm.WindowState = FormWindowState.Maximized;
SetWindowPos(Hwnd, 0, 0, 0, Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height, 0x0040);
}
public void Stop ()
{
EnableToolbar(true);
}
public static void EnableToolbar (bool enabled)
{
IntPtr p = FindWindow("HHTaskBar", null);
if (p == IntPtr.Zero)
return;
//IntPtr i = ShowWindow(p, enabled ? 1 : 0);
//bool b = EnableWindow(p, enabled);
ShowWindow(p, enabled?1:0);
EnableWindow(p, enabled);
}
[DllImport("coredll.dll")]
private static extern bool SetWindowPos (IntPtr hwnd, int hwnd2, int x,
int y, int cx, int cy, int uFlags);
[DllImport("coredll.dll")]
private static extern IntPtr FindWindow (string lpClassName, string
lpWindowName);
[DllImport("coredll.dll")]
private static extern IntPtr GetCapture ();
[DllImport("coredll.dll")]
private static extern IntPtr ShowWindow (IntPtr hWnd, int visible);
[DllImport("coredll.dll")]
private static extern bool EnableWindow (IntPtr hwnd, bool enabled);
--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com
I've tested your samplecode and it works great with SP3!
The problem was, I've called the Kiosk in constructor of the form. In SP2
this worked without any problems.
Calling Kiosk at "Form_Load" event solved the problem!
Thank you very much!
Regards, Stefan