can anyone help me with mouse handling in c++. espcially on how to check mouse clicking. i am making a game connect four so if anyone could help me with the code and explaining a couple of functions i would really appreciate it. help required urgently.

10 Years
Discussion Span
Last Post by amna_aries1

It depends what platform your building your game for. C++ doesn't know about 'mice'

If you're creating your game for Windows, you need to look at the Win32 API. Particularly the message loop or 'pump' as it's sometimes called. Windows will send mouse event msgs with parameters to this function within your C++ program where you can then decide how to handle them.

So Google for some of the terms I've mentioned and you can come back when your problem's a little more specific.


> and explaining a couple of functions i would really appreciate it

int main ( ) {
  // your code goes here
  return 0;

All C and C++ programs begin with this function. When the function returns 0, this indicates that the program has successfully run to completion. Other values you can return are specified using the EXIT_SUCCESS and EXIT_FAILURE macro constants.

Further, int main ( int argc, char *argv[] ) introduce the mechanism by which you can specify command line parameters to the program.

> can anyone help me with mouse handling in c++
Standard C++ knows nothing about mice, or any other kind of rodentae. You need to tell us which operating system, compiler, graphics library etc you're using.

> help required urgently.
I'm sure it is, but that isn't my problem.


You need to make use of MFC apis. Just create an application in VC++ environment and use the mouse operation apis.


i am using windows xp OS and not sure about the version but i have borlandc++.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.