` Printed Icetips Article

Icetips Article



Par2: Set NumLock from Clarion app
2008-04-25 -- Daan Marais
 
Ok, found the answer I was looking for in comp.lang.clarion, quoted here for 
completeness: (credit to  
Markku Niskanen)

        Module ('Win API')
           GetKeyboardState(*CSTRING),RAW,PASCAL
           SetKeyboardState(*CSTRING),LONG,RAW,PASCAL
        end

Global Variables        

        KeyboardState   Cstring(257)

For your window or application, whichever you wish, set
the Timer value to 10 or something like that (that is, the
timer message is received every 1/10 seconds, which
should be sufficient).

Add to the Timer embed the following code:

    GetKeyBoardState(KeyBoardState)     ! Get state to buffer
    KeyboardState[91H] =80H             !
    Result# = SetKeyboardState(KeyboardState) ! Set state

And that will do the trick!! 

He (later) adds:

MSDN says 

Because the SetKeyboardState function alters the input state of the calling 
thread and not the global input state of the system, an application cannot use 
SetKeyboardState to set the NUM LOCK, CAPS LOCK, or SCROLL LOCK lights on the 
keyboard etc etc



Printed May 3, 2024, 9:46 pm
This article has been viewed/printed 35116 times.