kim at martel.com.au
kim at martel.com.au
Mon May 24 12:28:07 UTC 2021
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)
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of
Sent: Monday, 24 May 2021 9:33 PM
To: OmnisList <omnisdev-en at lists.omnis-dev.com>
Subject: Re: Number lock
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.
> 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 -
> 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...'
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.
More information about the omnisdev-en