-
Mouse_event
ok Im trying to do somting like this dont know the code and cant figure it out so if you guys could help that would be great
wait untill mouse = mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
or somting like this
how do I go about doing this thanks
Dev-C++ on windows XP
-
what are you trying to do? wait until the left mouse button is released? There is no return value for the function mouse_event(). mouse_event() is used to create an event, not see if an event occured.
-
After reading your post on this, and your post on the finding color values, it seems like you are trying to dive into the Windows API too deep too fast without having a good knowledge of some more basic things.
Whatever the case is, there's millions of ways you can capture a mouse event, depending on the API you are using.
-
To capture a mouse event you can write code for WM_ mouse messages that get sent to your window.
Many APIs have different ways of dealing with this core Win32 message handling method but they are all fairly similar in function.
-
The way I do that is something like this which processes windows messages. I suppose you could implement something similar. (Just make sure you add some condition where you step out of the loop).
Code:
MSG wmsg;
while (GetMessage(&wmsg, NULL, 0,0))
{
if (wmsg.message == WM_LBUTTONUP) dostuff;
}
-
hay thatks I'll geve it a try : )
Code:
int main()
{
int x, y;
while (mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0))
{
if (mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0))
cout << "test";
;
}}
I get this error "coid value not ignored as it ought to be".
can some one tell me what that means?
I am using Dev-C++ in windows XP.
-
I take it the error message is "void value not ignored".
mouse_event() appears to be a "void" function - meaning it doesn't return anything.
Did you try the code posted by DrSnuggles?
--
Mats
-
O thank you I dident understand the void thing yet maby this one is to hard for me now ill finish my book 1st. : )
-
void is used to indicate that the function doesn't return ANYTHING - it has no "value" to "return".
--
Mats
-
In my first post I stated this function returns nothing. Understanding return values, using return values, and definitely void is key before using any functions in while and if statements.