Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Compact framework SP3 and kiosk mode

103 views
Skip to first unread message

<ctacke/>

unread,
Sep 9, 2005, 7:43:24 AM9/9/05
to
How are you hiding the taskbar?

-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?


WebJumper

unread,
Sep 9, 2005, 8:13:02 AM9/9/05
to
//
// Author: Sergey Bogdanov <sergey....@gmail.com>
// Url: http://www.sergeybogdanov.com
//
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;

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

unread,
Sep 9, 2005, 9:05:11 AM9/9/05
to
Well, it was tested against SP3. Where do you call Start()? And can you
reproduce this problem on the test application which comes with CEKiosk
sample? As I see through the code you are slightly modify sample - maybe
this causes the problem.

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

WebJumper

unread,
Sep 13, 2005, 3:46:07 AM9/13/05
to
Hello Sergey!

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

0 new messages