Click here to Skip to main content
14,664,050 members
Rate this:
Please Sign up or sign in to vote.
See more:
i want the mouse right click should not work when my application is running...and starts when application is closed.....
Updated 19-Apr-11 2:15am
[no name] 19-Apr-11 8:11am
Can you describe the intended purpose of this?

Also, check your caps lock.
snorkie 19-Apr-11 16:22pm
Why is it that somebody always has to ask "Why are you doing this" when somebody asks an honest question? wouldn't it be easier to answer or not answer. It seems that people are reamed when they don't make their question specific enough, but people can ask this generic question and get away with it.

To shanku.shau: Are you asking for the mouse not to work within your application, or in all of Windows when you are running?
[no name] 19-Apr-11 21:31pm
The question was not "Why are you doing this?" but rather what is the purpose, and was asked to assertain if alternative could be presented.
DaveAuld 19-Apr-11 8:13am
Looks like you have managed to Lock your CAPS LOCK key successfully.........:)
Groulien 19-Apr-11 8:15am
Don't you mean 'How to lock and unlock your Caps Lock'?
Thank the heavens that text-to-speech does not shout when using caps :p .
shanku.sahu 19-Apr-11 8:16am
please reply i am in urgent need of it
Tarun.K.S 19-Apr-11 8:20am
Is it an ASP.NET Application?
shanku.sahu 19-Apr-11 8:21am
no it is a win application
BobJanova 19-Apr-11 10:03am
You could probably do it with a mouse hook. However, if you did this on my machine I would hunt you down and disembowel you with a brick. It violates the principle of separation of applications and would make your app a major nuisance. What is the purpose of this requirement?
Sergey Alexandrovich Kryukov 19-Apr-11 16:40pm
Application-wide of system-wide?! This is the main question.

Rate this:
Please Sign up or sign in to vote.

Solution 1

You want the right mouse button to not work at all while your application is running? What possible reason could you have for wanting to do this?

Stealing the mouse right-button click from other apps is a) not a valid implementation goal, and b) not recommended.
Sergey Alexandrovich Kryukov 19-Apr-11 16:36pm
Attempted computer crime detected, my 5.
Rate this:
Please Sign up or sign in to vote.

Solution 2

BobJanova 19-Apr-11 10:06am
Good link, which demonstrates how to filter messages within a single application (actually, a single thread, but a WinForms app generally has only a single UI thread). Generally though if you wanted to avoid responding to right clicks in your own app you could just use a boolean static flag somewhere.
Sergey Alexandrovich Kryukov 19-Apr-11 16:39pm
John assumed that the question was about system-wide block (which is possible but would be a crime against the user). It looks like. If fact, this is not clear.
If it is just for the application, I agree with Bob: good link, I also vote 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100