Number lock
kim at martel.com.au
kim at martel.com.au
Mon May 24 12:28:07 UTC 2021
Hi Kelly
Thank you again.
I have implemented your code and it is working the way I would like.
My program is the main program with only occasional office which is better
if the number lock is on all the time.
(running win 10 or Server 16 and OS 10.2)
Regards
Kim
-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of
Kelly Burgess
Sent: Monday, 24 May 2021 9:33 PM
To: OmnisList <omnisdev-en at lists.omnis-dev.com>
Subject: Re: Number lock
Hi Kim,
I did get that keybd_event API to work with Register/Call DLL - I'd been
registering it wrong. Here's how it should go for numLock - 144 is the
virtual key, 69 is the scan code.
Register DLL ('user32','keybd_event','VJJJJ')
Call DLL ('user32','keybd_event',144,69,1,0) ;; key press
Call DLL ('user32','keybd_event',144,69,3,0) ;; key release
For capsLock it was 20,58 for the vkey,scancode.
One thing to note is you can't immediately follow that code with another
call to GetKeyState and see the change, because the keyboard events won't
have been processed yet. And remember the caution about not ticking people
off, if your app isn't the only thing running on the computer. You could
use $omnistofront, note the current state, do what you need to do, and
restore the state on quitting or $omnistoback.
Kelly
> On May 24, 2021, at 5:09 AM, Kelly Burgess <kellyb at montana.com> wrote:
>
> Hi Kim,
>
>> is there a command that if result=0 that you can automatically set
>> result to 1
>
> I see an example of how to do that here -
>
>
> https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-
> keybd_event?redirectedfrom=MSDN
>
> but I haven't been able to get Register/Call DLL to work with the
keybd_event function. You could probably write an xcomp to do it.
>
> And I also saw several commenters saying 'please don't do that unless the
machine is dedicated to your app, otherwise users will find it Very Annoying
when you switch that global setting on them...'
>
> Kelly
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com
--
This email has been checked for viruses by AVG.
https://www.avg.com
More information about the omnisdev-en
mailing list