|
|
|
date: Mon, 7 Jul 2008 09:28:03 -0700,
group: microsoft.public.dotnet.framework.compactframework
back
RE: Best way to make screenlock/keylock?
If the device supports key lock you could force a keyboard event:
keybd_event(0x85, 0, 0, 0);
[DllImport("coredll.dll", EntryPoint = "keybd_event", SetLastError = true)]
internal static extern void keybd_event(byte bVk, byte bScan, int
dwFlags, int dwExtraInfo);
See the key codes here: http://msdn.microsoft.com/en-us/library/bb431750.aspx
There might be a better way, but this works as I just tested it on my devices.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com
"juvi" wrote:
> Hello,
>
> Is it possible to lock screen and keys and unlock them with an unlock
> method.....have no idea for that.....thx juvi
date: Wed, 9 Jul 2008 00:31:00 -0700
author: Simon Hart [MVP]
Re: Best way to make screenlock/keylock?
You can also use the GAPI. Theres a function called GXOpenInput() and
GXCloseInput().
GXCloseInput - Turns on the unfiltered button message mode. All hardware
button presses generate appropriate WM_KEY messages to the application and
are not sent to the shell.
GXOpenInput - returns button-press messages to their filtered mode.
You can call it from managed code by:
public static bool LockHardwareButtons() {
try {
GXOpenInput();
return true;
}
catch (MissingMethodException) {
return false;
}
}
public static bool UnlockHardwareButtons() {
try {
GXCloseInput();
return true;
}
catch (MissingMethodException) {
return false;
}
}
[DllImport("gx.dll", EntryPoint = "#9")]
private static extern int GXOpenInput();
[DllImport("gx.dll", EntryPoint = "#3")]
private static extern int GXCloseInput();
--
Best Regards,
Christian R. Helle
http://christian-helle.blogspot.com
"Simon Hart [MVP]" wrote in message
news:89BA5921-6993-4DE5-B3C0-769D2088BFF9@microsoft.com...
> If the device supports key lock you could force a keyboard event:
>
> keybd_event(0x85, 0, 0, 0);
>
> [DllImport("coredll.dll", EntryPoint = "keybd_event", SetLastError =
> true)]
> internal static extern void keybd_event(byte bVk, byte bScan, int
> dwFlags, int dwExtraInfo);
>
> See the key codes here:
> http://msdn.microsoft.com/en-us/library/bb431750.aspx
>
> There might be a better way, but this works as I just tested it on my
> devices.
>
> --
> Simon Hart
> Visual Developer - Device Application Development MVP
> http://simonrhart.blogspot.com
>
>
> "juvi" wrote:
>
>> Hello,
>>
>> Is it possible to lock screen and keys and unlock them with an unlock
>> method.....have no idea for that.....thx juvi
date: Mon, 14 Jul 2008 11:40:56 +0200
author: Christian R. Helle
Re: Best way to make screenlock/keylock?
One thing to bear in mind is that GAPI (since WM5) has been marked as
deprecated and replaced with DDraw and will eventually be removed from future
releases of WM. I don't think DDraw allows for input.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com
"Christian R. Helle" wrote:
> You can also use the GAPI. Theres a function called GXOpenInput() and
> GXCloseInput().
>
> GXCloseInput - Turns on the unfiltered button message mode. All hardware
> button presses generate appropriate WM_KEY messages to the application and
> are not sent to the shell.
>
> GXOpenInput - returns button-press messages to their filtered mode.
>
> You can call it from managed code by:
>
> public static bool LockHardwareButtons() {
> try {
> GXOpenInput();
> return true;
> }
> catch (MissingMethodException) {
> return false;
> }
> }
>
> public static bool UnlockHardwareButtons() {
> try {
> GXCloseInput();
> return true;
> }
> catch (MissingMethodException) {
> return false;
> }
> }
>
> [DllImport("gx.dll", EntryPoint = "#9")]
> private static extern int GXOpenInput();
>
> [DllImport("gx.dll", EntryPoint = "#3")]
> private static extern int GXCloseInput();
>
> --
> Best Regards,
> Christian R. Helle
> http://christian-helle.blogspot.com
>
> "Simon Hart [MVP]" wrote in message
> news:89BA5921-6993-4DE5-B3C0-769D2088BFF9@microsoft.com...
> > If the device supports key lock you could force a keyboard event:
> >
> > keybd_event(0x85, 0, 0, 0);
> >
> > [DllImport("coredll.dll", EntryPoint = "keybd_event", SetLastError =
> > true)]
> > internal static extern void keybd_event(byte bVk, byte bScan, int
> > dwFlags, int dwExtraInfo);
> >
> > See the key codes here:
> > http://msdn.microsoft.com/en-us/library/bb431750.aspx
> >
> > There might be a better way, but this works as I just tested it on my
> > devices.
> >
> > --
> > Simon Hart
> > Visual Developer - Device Application Development MVP
> > http://simonrhart.blogspot.com
> >
> >
> > "juvi" wrote:
> >
> >> Hello,
> >>
> >> Is it possible to lock screen and keys and unlock them with an unlock
> >> method.....have no idea for that.....thx juvi
>
date: Mon, 14 Jul 2008 02:48:01 -0700
author: Simon Hart [MVP]
|
|