C++ mouse on taskbar button

My C++ program minimizes a screen when the key M is pressed. I am trying to read which mouse key is clicking on the taskbar's program button. So far I have used : if(GetAsyncKeyState(VK_RBUTTON) != 0){ ...} with a MessageBox for testing. Unfortunately, this condition is true when ever the mouse is pressed, even on the screen causes the condition's block to be executed. Does anyone please have an answer?

Thank you much,
Last edited on
Is your program a console or a GUI app?

Hi Andy, it is a window without the minimize box so that a press of the m key minimizes the window to the taskbar. Right click of the mouse was not working correctly like the left mouse button was, so I wanted to capture that it is the right mouse button to implement a solution.

A graphical user interface, what, mouse...,? the mouse is only used to remaximize, its a popup window that handles key presses!



I guess I should have mentioned, so far the implementation is in the MainWndProc, case WM_ACTIVATE:.

Thanks Again,
Right click of the mouse was not working correctly like the left mouse button was, ...

When I right click on a task bar button I get a context menu which allows me to Restore or Maximise, which is the expected behaviour.

What's going wrong in your case? Or do you expect to happen?


PS This post is about C#, but the same rules apply to C++

Handling Right Click/Left Click of Task-bar Button in c#

In a nutshell, it appears there is no way (certainly no legit way) to achieve your aim (if I understand you right.)
Last edited on
Hello again Andy.

Found that you seemed to be right, I was trying to capture that activate with a key press in the WndProc. Gave up to, and used cooperative DirectX input flags : DISCL_FOREGROUND | DISCL_NONEXCLUSIVE.

This prevented the windows key from making things difficult which was great as a new manner.

Everything looks good, I wonder however, should be good with multiple screens and other system key presses? Windows key and task manager are not callable while my full screen running.

Will there be problems with any other hotkeys or function keys/combinations: custom, etc.?

Oh, my cooperative display is DDSCL_NORMAL. To me it seems like everything should be okay, Well I mean, its : NORMAL!

Thanks again and thanks to you Andy,

P.S. I guess what I'm asking is to keep the Full Screen on the monitor not interacting with other screens (display and input) until quitted with the completed escape key press implementation. And Are there any other key presses that need to be considered? I hope its not to difficult!

Glad you got your problem sorted.

But I have no idea what other key presses, etc. you'd need to handle; it's not something I've needed to do.

Topic archived. No new replies allowed.