473,938 Members | 2,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to disable the pop-up control/system menu?

In the Form there is the Control/System menu.
I wish to prevent this system menu from poping-up although the minimize,
maximize and close buttons is still shown on the Form caption bar.

How can I do that?
----------
Thanks
Sharon
Jan 4 '06 #1
2 3908
Hi Sharon,
In the Form there is the Control/System menu.
I wish to prevent this system menu from poping-up although the minimize,
maximize and close buttons is still shown on the Form caption bar.


The obvious solution for this problem would be to set the ControlBox
property of the form to false. However, the problem with this method is that
the minimize and maximize buttons get lost also. Secondly, you could try
changing the FormBorderStyle property, in case this would be appropriate in
your case.

Since these simple solutions probably aren't what you are looking for, I
believe you need to do quite a lot of coding yourself. Unless you want to
get into the business of drawing the whole window title bar yourself (the
"non-client area") which gives you the ultimate control, I'm quite certain
your only possibilities are to fiddle with Windows messages, such as
WM_NCHITTEST and WM_SYSCOMMAND, among others (for example to disable
keyboard functionality).

However, before you proceed with this quest, I would really suggest thinking
twice whether you really want to do it. Frankly said, I'd hate to use an
application with the Control menu disabled, because that would also disable
Alt+Space, the often-used shortcut to manipulate the window. Not all people
use just the mouse.

Sorry that I don't have a definite answer nor any code available this time,
but I hope this gives you a pointer where to start.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethi s.dystopia.fi
http://www.saunalahti.fi/janij/
Jan 4 '06 #2
Hi Sharon,

Thanks for your post.

Yes, I also agree with Mr. Jani Järvinen that we'd better do not disable
this system context menu, which is a big convinient for user. Also, this
will cause inconsistent UI experience for end user.

Anyway, if you really want get this done. If you use Spy++ to monitor the
windows messages, we will see that we can disable WM_SYSCOMMAND with
SC_MOUSEMENU to get what you want. Like this:
int WM_SYSCOMMAND=0 x112;
protected override void WndProc(ref Message m)
{
if(m.Msg==WM_SY SCOMMAND)
{
if((int)m.WPara m==0xF093)
{
m.Result=IntPtr .Zero;
return;
}
}
base.WndProc (ref m);
}
Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jan 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5996
by: Bob Bedford | last post by:
I create checkboxes using datas from a database (with PHP). I store all values in an array, as I must pass this value like a Form value. Now, in some cases, when a checkbox is selected, I must disactivate other checkboxes. How can I do this ? here is the code:
3
6762
by: Marcus Otmarsen | last post by:
During the last months I obeserved a growing number of web pages with popups inside a web page. I don't know the technique by which these in-page-windows are implemented (either Javascript or HTML?). They contain a "close" resp. "x" button/link to click them away. They are however not detectable by "normal" popup blockers. How can I otherwise turn these popup windows automatically (!) off otherwise? Marcus
1
6030
by: Terry Olsen | last post by:
Is there any way to disable the client browser "Back" and "Forward" buttons while on my site? Or how would I go about knowing that a page hit is caused by a back/forward navigation? I have discovered that my web app is definately NOT Back/Forward safe. It's really messing with my SQL data bigtime. Thanks.
4
3136
by: Chris | last post by:
I have an asp.net page say page1.aspx. The form in html code is <form id = "Form1"> And i want to disable all the fields of the form after some code steps. I had created a javascript funct: function disable() { alert("Forms length is :" + Form1.length); for (i = 0; i < Form1.length; i++) { var formElement = Form1.elements;
9
68339
by: preetksaini | last post by:
hi, i want to know that how can i disable the close (x) button of pop window,using javascript. thanx.
0
10126
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11515
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11282
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
8209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6287
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4900
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3495
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.