Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mouse position using c

Tags:

c++

c

mouse

As part of a small app I am working on, I need to find a way to return the coordinates of the mouse on the screen when I click. I am looking for a solution that would run the same across operating systems, or at least the same on Unix systems. I'm wondering if there's a low-level solution for this. I have seen solutions implemented in Java, C#, and Python, but they all involve using a larger framework.

like image 733
cbsm1th Avatar asked Mar 15 '26 18:03

cbsm1th


1 Answers

I would suggest using Qt. The problem is that, you will have different windowing systems on different platforms, potentially even on Linux.

As a fallback, you could check how Qt gets this bit right across the platforms, and copy/paste that into your software. It might bring further dependencies into your software.

gtk is also an option, but it might not be a cross-platform solution such as Qt or wxWidgets, or even FLTK. However, gtk is closer to your initial requirement, the C programming language.

like image 64
lpapp Avatar answered Mar 18 '26 06:03

lpapp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!