Keyboard Function not detecting F10

General FreeBASIC programming questions.
Gablea
Posts: 1037
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Keyboard Function not detecting F10

Postby Gablea » Feb 13, 2019 21:33

Hi everyone

I am using this code to control the Keyboard


Code: Select all

function GetKeyNB() as integer
    dim as string key
    key = inkey
    select case len(key)
        case 0
            return 0
        case 1
            return key[0]
        case 2
            return key[0] + (key[1] shl 8)
    end select
end function


It works great apart from it does not detect the F10 key. Do I need to do something to get this to work?


This is example from my code

Code: Select all

Do
       key = GetKeyNB
       If key Then
          PrintKeyDetails(Hex(key))          
       End  If
   Loop Until key = 27 ' ESC
maachal
Posts: 27
Joined: Jul 21, 2017 21:11
Location: czech

Re: Keyboard Function not detecting F10

Postby maachal » Feb 14, 2019 8:40

Is not it better to use multikey? Scancode &h44.
Gablea
Posts: 1037
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Re: Keyboard Function not detecting F10

Postby Gablea » Feb 14, 2019 8:59

If i know how to use that I would :) I have the following set up


Dim Key_1 as Long = "&h31"

Code: Select all

Do
       key = Hex(GetKeyNB)
       If key = Key_1 then
               Print "KEY 1 Was Pressed"
       End  If
   Loop Until key = 27 ' ESC
StewartMorgan
Posts: 1
Joined: Feb 07, 2019 8:37

Re: Keyboard Function not detecting F10

Postby StewartMorgan » Feb 14, 2019 12:37

Since yesterday my laptop F10 key isn't working anymore. I runned system restore configuration and restored the system at the status of 1 week ago. I also tried to hit the key with another plugged in keybord, without success.
maachal
Posts: 27
Joined: Jul 21, 2017 21:11
Location: czech

Re: Keyboard Function not detecting F10

Postby maachal » Feb 14, 2019 13:43

Code: Select all

function GetKeyNB() as integer
    dim as string key
    key = inkey
    select case len(key)
        case 0
            return 0
        case 1
            return key[0]
        case 2
            return key[0] + (key[1] shl 8)
    end select
end function

dim key as integer 'add
Do
       key = GetKeyNB
       If key Then
          'PrintKeyDetails(Hex(key))  'remove
          Print(Hex(key))          'add
       End  If
Loop Until key = 27 ' ESC

I used your code and it works. F10 returns 44FF, F9 returns 43FF, etc. Probably the problem of the laptop?

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest