views:

630

answers:

3

Good day.

I have a program thats launches an external application. That external app has a right click sub menu on it which I need to disable. Is it possible (without modifying the external app) to disable the right click? Maybe permission or group policies and etc.

Thanks.

+1  A: 

I wasn't sure I wanted to post as I don't have a huge amount of scope on the matter, but it's definatley possible. If you have a handle to the application (if not you can get one) you can use that to disable right click within the application.

http://www.codeguru.com/forum/showthread.php?t=190440

http://support.microsoft.com/kb/318804

seems like the most helpful links, it just goes on about how you should hook and then disregard WM_RBUTTONDOWN and WM_RBUTTONUP.

I'll try and write up a better thing later with an example.

More links/edits

This link could be useful as it explains that you're going to need to use unmanaged c/c++ to hook using setWindowsHookEx.

http://social.msdn.microsoft.com/Forums/en-US/clr/thread/8dd657b5-647b-443b-822d-ebe03ca4033c/

Hope this helps

[EDIT]

I think this can actually be done in a C# application completely. I will post a solution tonight

[/EDIT]

PintSizedCat
Thanks a lot! Haven't tried it yet but I will try it soon. If you will provide an example in C#, it'll be great, but do not bother too much.
I've not done anything in c# before, so it'll be a challenge to say the least :)
PintSizedCat
Ok, no problem I'll try to handle it by myself. Thanks anyway :)
A: 

It's a win32 api FAQ.

see news://194.177.96.26/comp.os.ms-windows.programmer.win32 where it has often been discussed

A: 

I know a brutal solution for Windows. Make a hook on mouse and filter all messages, going to the external program window. It can slow down a whole system a little though.

It's not that comlicated. Here's a tutorial: http://win32assembly.online.fr/tut24.html Nevermind assembler, it works the same way in any language.

akalenuk