Compact framework SP3 and kiosk mode

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
//
// Author: Sergey Bogdanov <sergey.bogdanov@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);
}
}
 
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.
 
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

Sergey Bogdanov said:
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

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