Skip to content


Bloqueo y suspensión del Pocket PC por codigo

Con esta clase que ha desarrollado Carlitros podemos bloquear (barra de inicio y teclado hardware) y suspender una PDA por código.

[code lang=»csharp»]
public class BloquearPDA
{
#region DLL’s
[DllImport(«Coredll.dll», EntryPoint = «FindWindow»)]
private static extern System.IntPtr FindWindow(string lpClassName, string lpWindowName);

[DllImport(«coredll.dll», EntryPoint = «EnableWindow»)]
private static extern bool EnableWindow(IntPtr hWnd, bool value);

[DllImport(«gx.dll», EntryPoint = «#9»)]
public static extern int GXOpenInput();

[DllImport(«gx.dll», EntryPoint = «#3»)]
public static extern int GXCloseInput();

[DllImport(«coredll.dll»)]
private static extern void GwesPowerOffSystem();
#endregion

public static void BloqueaBarraInicio()
{
IntPtr taskBarHandle;
taskBarHandle = FindWindow(«HHTaskBar», «»);
EnableWindow(taskBarHandle, false);
}

public static void DesbloquearBarraInicio()
{
IntPtr taskBarHandle;
taskBarHandle = FindWindow(«HHTaskBar», «»);
EnableWindow(taskBarHandle, true);
}

public static void BloquearTeclasPDA()
{
GXOpenInput();
}

public static void DesbloquearTeclasPDA()
{
GXCloseInput();
}

public static void SuspenderPDA()
{
GwesPowerOffSystem();
}
}
[/code]
Espero que os sirva. Un saludo!!

Posted in C#, Compact Framework.

Tagged with , .