G'day, folks 😄
Can anybody offer a suggestion as to why the following program doesn't work - at least on my machine running 64-bit Windows 7 Home Premium.
Nothing happens when I hit a key at random. Ctrl-C is needed to abort the program.
It's not the entire application, just an extract to investigate why the keyboard monitor facility doesn't work for me.
C
integer keyin
character do_this*12
C
common keyin, do_this
C
include <windows.ins>
C
external kb_input
C
keyin=0
do_this='KEYBOARD_KEY'
C
call add_keyboard_monitor@(kb_input)
C
write(5, 91)
91 format(' Hit any key: ',$)
C
C loop to await an entry at the keyboard
C
100 if(keyin .ne. 0) goto 200
goto 100
C
C display the character code for the single input key, then pause
C
200 write(6,211) keyin
211 format(' From keyboard = ', i10)
C
call remove_keyboard_monitor@(kb_input)
C
pause
C
stop
end
C
integer function kb_input()
C
integer keyin
character do_this*12
C
common keyin, do_this
C
include <windows.ins>
C
keyin=clearwin_info@(do_this)
C
kb_input=1
C
return
end
C
Compilation and linking were done from a batch file:
C:\Users\Eric\Desktop\Program_Files_ex_C\Silverfrost\FTN95\FTN95 -c fdisplay.for /check /dump /list
C:\Users\Eric\Desktop\Program_Files_ex_C\Silverfrost\FTN95\SLINK fdisplay.obj -file:fdisplay.exe
And the listing file, with the line-numbered code removed, reported nothing untoward:
Silverfrost FTN95/WIN32 Ver 5.50.0 fdisplay.FOR Sun Oct 18 13:20:44 2015
Compiler Options in Effect:
CFPP CHECK COLOUR DELETE_OBJ_ON_ERROR DUMP LIST MINIMISE_REBUILD NO_QUIT
NON_STANDARD SINGLE_THREADED
Dump of all variables in MAIN@
Local Variables
INTEGER(KIND=3) FUNCTION WINDOW_PRINTF@ WINDOW_PRINTF@ (at line 175)
INTEGER(KIND=3) FUNCTION WINIO@ WINIO@ (at line 177)
// CHARACTER(LEN=12) DO_THIS @ 4 (at line 4)
// INTEGER(KIND=3) KEYIN @ 0 (at line 2)
Total stack size: 24 bytes
Total static size: 105 bytes
Dump of all variables in KB_INPUT
Local Variables
INTEGER(KIND=3) FUNCTION WINDOW_PRINTF@ WINDOW_PRINTF@ (at line 9683)
INTEGER(KIND=3) FUNCTION WINIO@ WINIO@ (at line 9685)
// CHARACTER(LEN=12) DO_THIS @ 4 (at line 9512)
// INTEGER(KIND=3) KEYIN @ 0 (at line 9510)
Total stack size: 16 bytes
Total static size: 112 bytes
End of Compilation - Clocked 0.76 seconds
Eric, in Perth, Western Australia