PC Review


Reply
Thread Tools Rate Thread

Disabling right clicks on a console based C# app

 
 
Dilip
Guest
Posts: n/a
 
      18th Jun 2008

I have written a C# based console application. Due to some issues
thats been causing me endless nightmares, I was wondering, is there a
way to prevent right mousebutton clicks on my application when it
appears on the task bar? I don't want the context menu showing up
when a user right clicks on it. I don't want the user to be able to
do anything with it other than stare at it in its minimized form. I
know we can P/Invoke into some Win32 APIs to hide it completely
(FindWindow/ShowWindow/SW_HIDE) but for the moment is what I am aiming
to do possible?

I know there are many other ways to sidestep this problem completely
but the for the moment I am stuck with what I have (due to legacy
issues) and I need to find a way to disable the context menu from
showing up when an user right clicks on my app on the task bar.

 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      18th Jun 2008
On Jun 18, 5:08*pm, Dilip <rdil...@lycos.com> wrote:
> I have written a C# based console application. *Due to some issues
> thats been causing me endless nightmares, I was wondering, is there a
> way to prevent right mousebutton clicks on my application when it
> appears on the task bar? *I don't want the context menu showing up
> when a user right clicks on it. *I don't want the user to be able to
> do anything with it other than stare at it in its minimized form. *I
> know we can P/Invoke into some Win32 APIs to hide it completely
> (FindWindow/ShowWindow/SW_HIDE) but for the moment is what I am aiming
> to do possible?


It sounds unlikely.

> I know there are many other ways to sidestep this problem completely
> but the for the moment I am stuck with what I have (due to legacy
> issues) and I need to find a way to disable the context menu from
> showing up when an user right clicks on my app on the task bar.


I'm intrigued to hear why you're stuck with it being a console
application when you don't need a console. Why not just make it a GUI
app which doesn't show any forms?

Jon
 
Reply With Quote
 
Dilip
Guest
Posts: n/a
 
      18th Jun 2008
On Jun 18, 11:15 am, "Jon Skeet [C# MVP]" <sk...@pobox.com> wrote:
> On Jun 18, 5:08 pm, Dilip <rdil...@lycos.com> wrote:
> > I know there are many other ways to sidestep this problem completely
> > but the for the moment I am stuck with what I have (due to legacy
> > issues) and I need to find a way to disable the context menu from
> > showing up when an user right clicks on my app on the task bar.

>
> I'm intrigued to hear why you're stuck with it being a console
> application when you don't need a console. Why not just make it a GUI
> app which doesn't show any forms?


Because its a humongous application Jon. I don't know what might
happen if I convert it to an GUI app. It interacts with so many other
apps via remoting and such. At the very least it is going to involve
re-testing the entire functional specifications which probably will
not happen this late in the day. That is a kind of change the mgmt
won't allow anyway. At least for the current release I need to find a
way to prevent the context menu from showing up.
 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      18th Jun 2008
On Jun 18, 5:29*pm, Dilip <rdil...@lycos.com> wrote:

<snip>

> Because its a humongous application Jon. *I don't know what might
> happen if I convert it to an GUI app.


All you'd be changing is whether or not a console is allocated. Just
the project type, in the project settings. I'm not suggesting adding
an actual UI or anything like that - just changing a single property
of the project.

> *It interacts with so many other
> apps via remoting and such. *At the very least it is going to involve
> re-testing the entire functional specifications which probably will
> not happen this late in the day. *That is a kind of change the mgmt
> won't allow anyway. *At least for the current release I need to find a
> way to prevent the context menu from showing up.


I'm 99% sure that if you *do* find a way of doing that, it'll involve
considerably more risky changes than just changing it from a console
app to a WinForms app which happens not to ever create or display
anything.

If you're afraid of anything concrete in terms of not allocating a
console, how convinced are you that disabling the context menu won't
have similar effects?

Jon
 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      18th Jun 2008

"Dilip" <(E-Mail Removed)> wrote in message
news:3f8415c0-e2bb-4306-afe2-(E-Mail Removed)...
>
> I have written a C# based console application. Due to some issues
> thats been causing me endless nightmares, I was wondering, is there a
> way to prevent right mousebutton clicks on my application when it
> appears on the task bar? I don't want the context menu showing up
> when a user right clicks on it. I don't want the user to be able to
> do anything with it other than stare at it in its minimized form. I
> know we can P/Invoke into some Win32 APIs to hide it completely
> (FindWindow/ShowWindow/SW_HIDE) but for the moment is what I am aiming
> to do possible?
>
> I know there are many other ways to sidestep this problem completely
> but the for the moment I am stuck with what I have (due to legacy
> issues) and I need to find a way to disable the context menu from
> showing up when an user right clicks on my app on the task bar.
>


I used the gpedit.msc in the Run box on the machine running Vista Ultimate,
went to the group policy listed below and enabled it. No one can
right-click an application setting on the task bar.

http://www.microsoft.com/technet/pro....mspx?mfr=true

Maybe, that's what you need to do, if this is a dedicated machine for
running legacy solutions.

The link was for Win 2K, but the same thing can be done on Vista, and I will
assume it can be done for other MS NT class O/S(s).


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting/ Disabling double right clicks on the mouse. =?Utf-8?B?SUxNZXJnZUhlbHA=?= Microsoft VB .NET 0 21st Sep 2004 05:33 PM
disabling the mouse clicks giannis Microsoft Access Forms 4 4th Nov 2003 08:39 AM
disabling the mouse clicks giannis Microsoft Access 4 4th Nov 2003 08:39 AM
Disabling context menu(right clicks) on the quick launch toolbar Eric Romero Microsoft Windows 2000 Group Policy 0 1st Oct 2003 08:08 PM
Disabling playing mouse clicks on WinXP Pro Joe Clemmons Windows XP Customization 0 4th Sep 2003 02:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:34 PM.