>> How can I turn the VK_NUMLOCK On and Off?

> var
>   KS:Tkeyboardstate;
> begin
>   KS[VK_NUMLOCK]:= VK_NUMLOCK AND (NOT 1);
>   SetKeyboardState(KS);
> end;

That piece above doesn't toggle the state does it? Since the RHS of the assignment
doesn't refer to the current state at all.

That is: Should the toggle line be
KS[VK_NUMLOCK] := KS[VK_NUMLOCK] XOR -1;

Toggle between 0 and -1. Assuming that it starts in one of those states which it might 
not
if the array isn't initialised. Also assuming that 0 and -1 are the correct states for 
the cells
of this array.

Also what are the valid values for the contents of each entry in that TKeyboardState
Array? Are the values just True and False (0 and not 0) or do they have meaningful 
values.

Why is (NOT 1) used? Isn't that just -2 (2s complement is Negate and add 1 isn't it and
NOT is a binary not rather than arithmetic)

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to