System Menu

  • Thread starter Thread starter John Bowman
  • Start date Start date
J

John Bowman

Hi,

I need to create a win form that appears on the taskbar, but is very limited
in functionality. So I've set ShowInTaskbar = True &
ControlBox = True. But I need to modify the system menu that appears from
clicking on the Control Box. Basically, when the user clicks on the Control
Box, I only want the "Close" command to be available. Does anyone know how
to get at that and disable the other items?

TIA,
 
* "John Bowman said:
I need to create a win form that appears on the taskbar, but is very limited
in functionality. So I've set ShowInTaskbar = True &
ControlBox = True. But I need to modify the system menu that appears from
clicking on the Control Box. Basically, when the user clicks on the Control
Box, I only want the "Close" command to be available. Does anyone know how
to get at that and disable the other items?

Did you have a look at the form's 'FormBorderStyle' and 'MinimizeBox'
and 'MaximizeBox' properties?
 
Hi, John

you have to use couple of Win32 API to do that. Here is sample:

IntPtr hMenu=GetSystemMenu(window_handle,false);
DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND);

You can see definitions on www.pinvoke.net and in Platform SDK -
GetSystemMenu and DeleteMenu functions.

HTH
Alex
 
If you do not have the MinimizeBox, then the minimize option is removed from the System Menu. And the same holds good for the other properties that Herfried pointed to
 
Hi John,

I did not look deep because Herfried did not direct give an answer, however
when it was my problem and I did not find a solution I would make the menu
everytime dynamicly new.

Maybe is that your solution.

Cor
 
* "=?Utf-8?B?QW5hbmRbTVZQXQ==?= said:
If you do not have the MinimizeBox, then the minimize option is
removed from the System Menu. And the same holds good for the other
properties that Herfried pointed to

On my Windows XP system, they are only disabled :-(.
 
Back
Top