[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Hold Shift key down and Mouse Click event

Posted on 2007-08-03
Medium Priority
Last Modified: 2013-11-20
I would like to respond when user hold the shift key down and mouse click.
How can I catch these two events occuring at the same time?
Question by:qkrwngml
LVL 22

Accepted Solution

mahesh1402 earned 500 total points
ID: 19624708
Check on out OnLButtonDown( UINT nFlags, CPoint point );
If the MK_SHIFT bit is set in the nFlags parameter, the shift key is down.

void CMyView::OnLButtonDown(UINT nFlags, CPoint point)
    if (nFlags & MK_SHIFT) {
      //shift key is pressed ..DO Processing
    CView::OnLButtonDown(nFlags, point);

LVL 13

Expert Comment

ID: 19624823

to do that global, use a key/mouse hook

set a flag when shift is pressed, unset it when shift is released

now in the mouse hook, check if the good button is pressed, and check for the shift flag

Author Comment

ID: 19629889
Great mahesh1402!

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question