Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB64 Phoenix Edition v3.7.0 Released!
#36
I'm having no issues with the updates to _DEVICES and related commands. Here is a test snippet of code that I wrote. It detects when new controllers have been added and when they have been disconnected.

Code: (Select All)
DIM Devices AS INTEGER
DIM Fcount AS INTEGER
DIM d AS INTEGER
DIM DeviceName AS STRING

Devices = _DEVICES
Fcount = 0

DO
    CLS
    _LIMIT 30
    Fcount = Fcount + 1
    IF Fcount = 30 THEN '                                        check for new devices once per second
        Fcount = 1
        IF _DEVICES <> Devices THEN Devices = _DEVICES '         if number of devices changes get new count
    END IF
    PRINT
    FOR d = 1 TO Devices '                                       print found devices
        COLOR 14, 1
        DeviceName = _DEVICE$(d)
        IF INSTR(DeviceName, "[DISCONNECTED]") THEN COLOR 7, 0 ' change color if disconnected
        PRINT " Found: "; _DEVICE$(d)
        COLOR 7, 0
    NEXT d
    _DISPLAY
LOOP UNTIL _KEYDOWN(27) '                                        press ESC to exit
There are two ways to write error-free programs; only the third one works.
QB64 Tutorial
Reply


Messages In This Thread
RE: QB64 Phoenix Edition v3.7.0 Released! - by TerryRitchie - 05-08-2023, 02:53 PM



Users browsing this thread: 1 Guest(s)