Num Lock with PB3.20 
Author Message
 Num Lock with PB3.20

Hi !

i'm programming in PB3.20 and i'm trying to activate the Num Lock-Key.
Has anyone an idea how to do this ?

Mfg
Markus Deuling



Fri, 24 Sep 2004 16:06:18 GMT  
 Num Lock with PB3.20

Quote:

> Hi !

> i'm programming in PB3.20 and i'm trying to activate the Num Lock-Key.
> Has anyone an idea how to do this ?

If you're programming in a DOS-only system, this will turn it on:

def seg=0
poke &h417,peek(&h417) or &b00100000

To turn it off:

def seg=0
poke &h417,peek(&h417) and &b11011111

Tom Lake



Fri, 24 Sep 2004 22:33:01 GMT  
 Num Lock with PB3.20


Quote:




Quote:
> > Hi !

> > i'm programming in PB3.20 and i'm trying to activate the Num Lock-Key.
> > Has anyone an idea how to do this ?

> If you're programming in a DOS-only system, this will turn it on:

Hi, thank you for your help.
It's a dos box in Windows XP and Windows 2000

Quote:

> def seg=0
> poke &h417,peek(&h417) or &b00100000

> To turn it off:

> def seg=0
> poke &h417,peek(&h417) and &b11011111

I tried it but it doesn't work. A friend of mine said that it maybe could be
solved by using the INT13. I took a look around but did not find any
documentation.

Has anyone an idea ?

Greetings
Markus Deuling



Sat, 25 Sep 2004 15:43:37 GMT  
 Num Lock with PB3.20
The professional version of DOSBOX has tools to assist with this...
please see http://www.powerbasic.com/products/dosbox/ for more
information.

Quote:

>Hi !
>i'm programming in PB3.20 and i'm trying to activate the Num Lock-Key.
>Has anyone an idea how to do this ?
>Mfg
>Markus Deuling

Lance
PowerBASIC Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Fri, 01 Oct 2004 19:07:49 GMT  
 Num Lock with PB3.20
$LIB ALL OFF
$ERROR ALL OFF
$OPTIMIZE SIZE
$CPU 80386
$FLOAT NPX
$COMPILE EXE

DECLARE FUNCTION IsShift% ()
DECLARE FUNCTION IsControl% ()
DECLARE FUNCTION IsAlt% ()
DECLARE FUNCTION IsSkrol% ()
DECLARE FUNCTION IsNum% ()
DECLARE FUNCTION IsCaps% ()
DECLARE FUNCTION IsInsert% ()
DECLARE SUB DrawMenuBar ()
DECLARE SUB ChangeBarColors ()

TYPE MENUBARCOLORS
  alt AS INTEGER
  skrol AS INTEGER
  shif AS INTEGER
  ctrl AS INTEGER
  caps AS INTEGER
  num AS INTEGER
  ins AS INTEGER
END TYPE

DIM mbc AS SHARED MENUBARCOLORS                                  ' #Mod.

'   KEYINFO.BAS shows how to put some key stuff in a menu bar

'   When using QBasic change the #Mod. marked line as follows:
'   DIM SHARED mbc AS MENUBARCOLORS

'   Author:     Egbert Zijlema (NL)
'   rev. date:  08/08/1995

CLS

  invisible% = 7                 ' background color of menu bar

  DrawMenuBar

  DO
    ChangeBarColors

    IF IsShift% THEN mbc.shif = 15 ELSE mbc.shif = invisible%
    IF IsControl% THEN mbc.ctrl = 15 ELSE mbc.ctrl = invisible%
    IF IsAlt% THEN mbc.alt = 15 ELSE mbc.alt = 0
    IF IsSkrol% THEN mbc.skrol = 15 ELSE mbc.skrol = invisible%
    IF IsNum% THEN mbc.num = 15 ELSE mbc.num = invisible%
    IF IsCaps% THEN mbc.caps = 15 ELSE mbc.caps = invisible%
    IF IsInsert% THEN mbc.ins = 15 ELSE mbc.ins = invisible%

  LOOP UNTIL INKEY$ = CHR$(27)

  COLOR 7, 0: CLS   ' restore default DOS color
END

SUB ChangeBarColors
  ' formulas to compute offsets and attributes

  ' OFFSETS:
  ' adressable screen memory has 4000 offsets, ranging 0 - 3999
  ' 0, 2, 4 etc. up to 3998 contain character's ascii code
  ' 1, 3, 5 etc. up to 3999 contain color attribute

  ' character offset = [(row - 1) * 160 +] (col - 1) * 2
  ' for the first row you may omit the part between square brackets (= zero)

  ' attribute offset = character offset + 1
  ' in this SUB only color attributes will be changed

  ' COLOR ATTRIBUTE:
  ' foreground + (16 * background)

  ' ADDRESS VIDEO SEGMENT:
  ' &HB800 if color card else &HB000 (this SUB assumes color card)

  DEF SEG = &HB800                     ' &HB000 if no color card present

  ' altkey:
  POKE (3 - 1) * 2 + 1, mbc.alt + (16 * 7)   ' = poke 5,mbc.alt + 112
  POKE 17, mbc.alt + 112
  POKE 29, mbc.alt + 112
  POKE 41, mbc.alt + 112

  ' scroll lock:
  FOR count% = 99 TO 109 STEP 2
    POKE count%, mbc.skrol + 112
  NEXT

  ' L-shift or R-shift ("shift = shift", the user said):
  FOR count% = 113 TO 121 STEP 2
    POKE count%, mbc.shif + 112
  NEXT

  ' ctrl:
  FOR count% = 125 TO 131 STEP 2
    POKE count%, mbc.ctrl + 112
  NEXT

  ' caps lock:
  FOR count% = 135 TO 141 STEP 2
    POKE count%, mbc.caps + 112
  NEXT

  ' insert:
  FOR count% = 145 TO 149 STEP 2
    POKE count%, mbc.ins + 112
  NEXT

  ' num lock:
  FOR count% = 153 TO 157 STEP 2
    POKE count%, mbc.num + 112
  NEXT

  DEF SEG           ' restore default segment
END SUB

SUB DrawMenuBar
  COLOR 0, 7
  LOCATE 1, 1: PRINT SPACE$(80);
  LOCATE 1, 3: PRINT "File"
  LOCATE 1, 9: PRINT "Edit"
  LOCATE 1, 15: PRINT "View"
  LOCATE 1, 21: PRINT "Help"

  ' now print invisible (foreground = background)
  COLOR 7
  LOCATE 1, 50: PRINT "SCROLL SHIFT CTRL CAPS INS NUM"

  COLOR 15, 0
  LOCATE 11, 2: PRINT "Sorry, folks!"
  COLOR 7
  LOCATE 13, 2: PRINT "This is not a working menu. I just want to show ";
  PRINT "you, how to put some"
  LOCATE 14, 2: PRINT "key information in your menu bar"
  LOCATE 16, 2: PRINT "So, press ";
  COLOR 15
  PRINT "Alt Ctrl Shift CapsLock NumLock Ins";
  COLOR 7
  PRINT " or ";
  COLOR 15
  PRINT "ScrollLock"
  COLOR 7
  LOCATE 18, 2: PRINT "(or press ";
  COLOR 15
  PRINT "Esc";
  COLOR 7
  PRINT " to finish this demo)"
END SUB

FUNCTION IsAlt%
  DEF SEG = 64
  IsAlt% = (PEEK(23) AND 8) = 8
  DEF SEG
END FUNCTION

FUNCTION IsCaps%
  DEF SEG = 64
  IsCaps% = (PEEK(23) AND 64) = 64
  DEF SEG
END FUNCTION

FUNCTION IsControl%
  DEF SEG = 64
  IsControl% = (PEEK(23) AND 4) = 4
  DEF SEG
END FUNCTION

FUNCTION IsInsert%
  DEF SEG = 64
  IsInsert% = (PEEK(23) AND 128) = 128
  DEF SEG
END FUNCTION

FUNCTION IsNum%
  DEF SEG = 64
  IsNum% = (PEEK(23) AND 32) = 32
  DEF SEG
END FUNCTION

FUNCTION IsShift%
  DEF SEG = 64
  IsShift% = ((PEEK(23) AND 1) = 1) OR ((PEEK(23) AND 2) = 2)
  DEF SEG
END FUNCTION

FUNCTION IsSkrol%
  DEF SEG = 64
  IsSkrol% = (PEEK(23) AND 16) = 16
  DEF SEG
END FUNCTION

--
Egbert Zijlema
"Visit the Basic Guru pages"
http://zijlema.basicguru.com


Quote:
> Hi !

> i'm programming in PB3.20 and i'm trying to activate the Num Lock-Key.
> Has anyone an idea how to do this ?

> Mfg
> Markus Deuling



Mon, 04 Oct 2004 05:26:44 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. num lock, caps lock, scroll lock lights

2. Num Lock and Caps Lock

3. a traffic light program with lock's (num loack Caps loack and scroll lock)

4. Network Lock Novell3.20 53b win98

5. Num lock on at all times

6. C3 DOS Num lock control

7. Num lock and W2000

8. NUM lock

9. Num Lock on EIP browse

10. Setting Num lock

11. dos debug program to toggle num lock light

12. Problem controlling Num-Lock LED

 

 
Powered by phpBB® Forum Software