How to pass clicks (MouseDown) events to HTMLViewer?

This is the most janky solution I’ve put together, but now IT FINALLY WORKS! :slight_smile: User32.dll writes the X coordinate in the first 3 bytes and the Y coordinate in the last 3 bytes, so by passing an Int64 by ref and then extracting the first and last 3 bytes, we can get the XY coordinates, precisely up to 4096x4096. If anybody has a larger screen and needs this to work, you’d read the first and last 4 bytes instead of 3. I don’t know anybody who uses a screen that’s larger than 4096 so for the moment, this is perfect! (well not perfect, but almost)

The janky IF covers the scenario where the last hex digit is a zero. This is guesstimated as a disposable byte if the resulting integer from the full 3 bytes is larger than the real screen’s height. Obviously, it will work +94% of the time, but there is a small chance that the disposable zero digit was actually good. For a project where the mouse moves a lot, I would guess you could achieve 100% accuracy by simply ignoring the frames where the last digit is a zero altogether. I don’t think it would be noticeable where the mouse changes position 50-60 times a second.

ezgif-3-aa4ced711c

So there you have it, how to capture (get + set) the mouse cursor in a Xojo app (for Windows) for free. Enjoy. Tested under both Windows 7 and Windows 10 (up to date release).

Check this capture out wow: :slight_smile:

ezgif-4-bcbd306628