Announcement

Collapse
No announcement yet.

NumLock setting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NumLock setting

    I work under W98SE and I use next segment of code for turn on NumLock.


    '************************************
    DEF SEG = 0
    M = PEEK( &H417 ) 'get keyboard toggles

    BIT SET M%, 5 'turn on num lock

    POKE &H417, M% 'set keyboard toggles
    DEF SEG
    ' ************************************


    It works pretty good if this segment is a part of a large program.
    After compiling into "LARGEPRO.EXE" NumLock is on and stay on
    when program finished.

    Stand alone segment works good in IDE.

    After compiling stand alone segment
    into "NUMLOCK.EXE" it does not work.

    Why ?

    Thanks for help.
    Lubos

    ------------------
    Lubos
    A view on PowerBASIC

  • #2
    The code is almost precisely what I use too, but there are at least a couple of proviso's:

    1. some keyboards only toggle the lights if an actual keypress is detected, not as a result of the port state being changed

    2. this method only works under non-NT versions of Windows.


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Thanks Lance !
      I add a INKEY$ and now it is OK.


      '*********
      DEF SEG = 0
      M = PEEK( &H417 ) 'get keyboard toggles

      BIT SET M%, 5 'turn on num lock

      POKE &H417, M% 'set keyboard toggles
      DEF SEG
      Kl$ = INKEY$
      system
      '********************
      Lubos

      ------------------
      Lubos
      A view on PowerBASIC

      Comment

      Working...
      X