System: Vista

What I want to do is to catch the mouse release event, which I have researched for but nothing useful came up. I found out the way to catch the pressed event:

#include <windows.h>
#include <iostream>

int main()
{
	// Grab a handle to the console inputbuffer
	HANDLE hConsole = GetStdHandle(STD_INPUT_HANDLE);
	DWORD dwRead = 0;
	INPUT_RECORD InputRec;

	// Start looping, waiting for messages
	while( TRUE )
	{
	// See if there's any messages
	ReadConsoleInput(hConsole,&InputRec,1,&dwRead);

		if((InputRec.EventType == MOUSE_EVENT)&&(InputRec.Event.MouseEvent.dwButtonState & FROM_LEFT_1ST_BUTTON_PRESSED))
		{
			printf("Left Mouse - Pressed.\n");
		}
	}
}

What I want to use it for is to catch the time elapsed between the 'pressed' and 'released' event.

System: Vista

What I want to do is to catch the mouse release event, which I have researched for but nothing useful came up. I found out the way to catch the pressed event:
What I want to use it for is to catch the time elapsed between the 'pressed' and 'released' event.

while( TRUE ) {
	    ReadConsoleInput(hConsole,&InputRec,1,&dwRead);

            if(InputRec.EventType == MOUSE_EVENT) {
                if(InputRec.Event.MouseEvent.dwButtonState & FROM_LEFT_1ST_BUTTON_PRESSED) {
			printf("Left Mouse - Pressed.\n");
		} else {
                        printf("Left Mouse - Released\n");
                }
            }
	}

That is wrong simply because that catches both left mouse button click and every and all mouse events (like movement, right click and so on...).

edit this part (InputRec.EventType == MOUSE_EVENT) to (InputRec.EventType == WM_LBUTTONDOWN)

didn't try it, but it might work.

That wont work because that is a specific event to be used in what I seek, and it is not an event type. So even if I did use it, it would just refer to another even type (if the declaration holds a value used in the event type).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.