Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reading multiple mice absolute position, keyboard with raw input api ?
#1
Question 
Well, we can read multiple mice in Windows - see the attached code 
  1. plug in 2+ USB mice
  2. make sure .h files are in program directory
  3. compile subprogram 'readmicesub43.bas" (or run it, it will run and immediately close)
  4. run the main program "readmicemain43.bas"
  5. try moving around the different mice on your PC, you should see letters move around the screen
  6. try clicking left and middle mouse buttons to hear sounds
  7. to quit, right click any mouse

However I'm not sure about reading the absolute position of the cursor - it tracks movement pretty good using dx/dy, but you can't quickly move a mouse and have the position jump immediately to where the mouse cursor should be. There is a value the subprogram reads that I thought might be the absolute position but doesn't seem to be. Any ideas? Also how to read the scroll wheel?

I'm also not sure how to detect keypresses in the current program. Normal methods of reading the keyboard like _BUTTON, _KEYHIT and _KEYDOWN from the main loop in the subprogram (which has the focus) don't seem to work. Maybe the keyboard needs to be read using Raw Input? And as long as we're using the Raw Input API to read the keyboard, can we read seperate input from multiple keyboards, like we do with mice? I found a bunch of information on using the Raw Input API to read keyboard input:

but this stuff is way over my head, and I would need some help translating this into QB64PE. 
With everyone's help I was able to get the mouse mostly working, so the keyboard should be possible too. 

If anyone is interested in giving this a look, that would be great.


Attached Files
.zip   readmice.zip (Size: 52.18 KB / Downloads: 24)
Reply


Messages In This Thread
reading multiple mice absolute position, keyboard with raw input api ? - by madscijr - 05-28-2024, 08:12 PM



Users browsing this thread: 3 Guest(s)