Hmmm, doesn't work for me.  From the help,

>SetKeyboardState
>
><snip>
>
>Remarks
>
>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
indicator lights on the keyboard. 

Seems fairly definitive.  What have I missed?

Cheers,
Carl

-----Original Message-----
From: Glen Boyd [mailto:[EMAIL PROTECTED]]
Sent: Friday, 23 June 2000 6:11 AM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Num Lock Flash


> Jeremy Coulter wrote:
> 
> Hi all.
> I was wondering if anyone has seen any code that will make the num
> lock light flash on  a keyboard ?

I use the following to flash all lights on the keyboard.  Take what you
need from it ;-)

      GetKeyboardState( ksOriginal );
      repeat
        begin
          GetKeyboardState( ksFlashing );
          if ksFlashing[ VK_CAPITAL ] = $80 then
            begin
              ksFlashing[ VK_CAPITAL ] := $81;
              ksFlashing[ VK_NUMLOCK ] := $81;
              ksFlashing[ VK_SCROLL  ] := $81;
            end
          else
            begin
              ksFlashing[ VK_CAPITAL ] := $80;
              ksFlashing[ VK_NUMLOCK ] := $80;
              ksFlashing[ VK_SCROLL  ] := $80;
            end;
          Application.ProcessMessages;
          for iDelay := 1 to 40000 do
            Application.ProcessMessages;
          SetKeyboardState( ksFlashing );
        end;
      until bClicked = True;
      SetKeyBoardState( ksOriginal );

Cheers

-- 
Glen Boyd               <[EMAIL PROTECTED]>
Programmer              Napier City Council
Private Bag 6010, Napier, NEW ZEALAND
Phone: +64-6-8357579    Fax: +64-6-8357574
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to