Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

While left mouse button is down - repeat mouse down thing

$
0
0

Hello! I need help with mouse messages. I want to make function repeatedly execute when left mouse button is down.

For example, when I use this code with keyboard messages, move_char(); executes repeatedly while L key is down:

case WM_KEYDOWN:
switch(wParam)
{
case VK_UP:
blabla();
break;

case 'L':
move_char();
break;

default:
break;
}

but when I use following to make it execute when left mouse button down, move_char(); executes only once :( meaning it is not repeating:

case WM_LBUTTONDOWN:
switch(wParam)
{
case VK_LBUTTON:   //or MK_LBUTTON (it doesn't matter)
move_char();
break;

default:
  break;
}

So, my question is: How to make  move_char(); work with mouse, the same way it works with keyboard???

P.S.: It works as I want with Directinput, but I want it to work with messages!

P.S.S.: Looks like the problem with executing mouse message, but I don't know any other way to recognise when mouse button is down with messages... 


Viewing all articles
Browse latest Browse all 15302


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>