Connecting Tech Pros Worldwide Forums | Help | Site Map

How to detect mouse click in C?

Newbie
 
Join Date: Jul 2007
Posts: 9
#1: Jul 2 '09
Hi,

I am using windows(XP).

In C, we can use scanf statement to accept any character.

I want to accept only mouse click as input.

How can I do in C?

Thanks in Advance,

Kishore

Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,195
#2: Jul 2 '09

re: How to detect mouse click in C?


The is no Standard C method of interfacing with any input device except the keyboard.

TBH even if you are running on Windows I am unaware of any function in the API you could use in a console application to intercept a mouse click.
Needs Regular Fix
 
Join Date: Jul 2008
Posts: 385
#3: Jul 3 '09

re: How to detect mouse click in C?


The very first google result for 'win32 console app mouse' (without quotes, just in case) contains example on mouse events in console from msdn.
Newbie
 
Join Date: Jul 2007
Posts: 9
#4: Jul 3 '09

re: How to detect mouse click in C?


Quote:

Originally Posted by newb16 View Post

The very first google result for 'win32 console app mouse' (without quotes, just in case) contains example on mouse events in console from msdn.

Thanks for the solution,

Regards,
kishore
Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,195
#5: Jul 3 '09

re: How to detect mouse click in C?


Wow, well you learn something everyday, now I need to try and remember this for the next time I get asked :D
Reply