?
Solved

Disabling some items in the system menu of the MDI Child form

Posted on 2002-07-15
1
Medium Priority
?
221 Views
Last Modified: 2008-02-20
Hi,
I need to disable the next (CTRL+F6) that comes up in the system menu of a MDI child form. Hoe do I do it?
0
Comment
Question by:VCGuru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
AlonHirsch earned 300 total points
ID: 7153685
I haven't tried this for the 'Next' menu option, but you can :
The easiset way is to remove the menu option from the system menu.

You need the following API declarations :
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long

and the following constants :
Private Const MF_BYPOSITION = &H400&
Private Const MF_REMOVE = &H1000&

Then, the following code will remove the menu item :
Public Sub RemoveSystemLastItem(frm As Form)
    Dim hMenu As Long
    Dim itemCount As Long
   
    ' get the handle of the system menu
    hMenu = GetSystemMenu(frm.hWnd, 0)
    ' get the number of items in the menu
    itemCount = GetMenuItemCount(hMenu)
    'remove the system menu Close menu item
    RemoveMenu hMenu, itemCount - 1, MF_REMOVE Or MF_BYPOSITION
    'remove the system menu separator line
    RemoveMenu hMenu, itemCount - 2, MF_REMOVE Or MF_BYPOSITION
End Sub

This will physically remove the last item on the system menu as well as the seperator just above it.

I use this code to remove the Close menu option.

HTH,
Alon
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question