Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Caps Locks within a program
#1
What do you use to make the Caps lock automaticly come on at the start of a Program and then come off before the Program terminates
Reply
#2
hmm.... you can poke something to change the status of caps lock, and all that. i'll look for it on glenn's page, though i think one of the poke examples had that very button.

aha! here it is!

from qb's help (defsg_ex.bas)

Code:
' *** DEFSG_EX.BAS ***
'
DECLARE SUB CapsOn ()
DECLARE SUB CapsOff ()
DECLARE SUB PrntMsg (R%,C%,M$)

CLS
CapsOn
PrntMsg 24,1,"<Caps Lock On>"
LOCATE 12,10
LINE INPUT "Enter a string (all characters are caps): ",S$
CapsOff
PrntMsg 24,1,"              "
PrntMsg 25,1,"Press any key to continue..."
DO WHILE INKEY$="" : LOOP
CLS
END

SUB CapsOn STATIC
' Turn Caps Lock on
   ' Set segment to low memory
   DEF SEG = 0
   ' Set Caps Lock on (turn on bit 6 of &H0417)
   POKE &H0417,PEEK(&H0417) OR &H40
   ' Restore segment
   DEF SEG
END SUB

SUB CapsOff STATIC
' Turn Caps Lock off
   DEF SEG=0
   ' Set Caps Lock off (turn off bit 6 of &H0417)
   POKE &H0417,PEEK(&H0417) AND &HBF
   DEF SEG
END SUB

SUB PrntMsg (Row%, Col%, Message$) STATIC
' Print message at Row%, Col% without changing cursor
   ' Save cursor position
   CurRow%=CSRLIN : CurCol%=POS(0)
   LOCATE Row%,Col% : PRINT Message$;
   ' Restore cursor
   LOCATE CurRow%,CurCol%
END SUB
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#3
i.e., turn it on if it's off or turn it off if it's on:

DIM BYTE AS INTEGER
DEF SEG = 0
BYTE = PEEK(&H417) XOR 64
POKE &H417, BYTE
DEF SEG
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)