Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Mon, 7 Jul 2008 09:28:03 -0700,    group: microsoft.public.dotnet.framework.compactframework        back       


Best way to make screenlock/keylock?   
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, 7 Jul 2008 09:28:03 -0700   author:   juvi

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]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us