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.

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();
}
}

Espero que os sirva. Un saludo!!

Artículos Relacionados

Posted in C#, Compact Framework. Tagged with , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.