Keyboard Function not detecting F10

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

Keyboard Function not detecting F10

Post by Gablea »

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: 33
Joined: Jul 21, 2017 21:11
Location: czech

Re: Keyboard Function not detecting F10

Post by maachal »

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

Re: Keyboard Function not detecting F10

Post by Gablea »

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

Post by StewartMorgan »

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: 33
Joined: Jul 21, 2017 21:11
Location: czech

Re: Keyboard Function not detecting F10

Post by maachal »

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?
Post Reply