Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep MDI child forms maximized when accessing other forms

Status
Not open for further replies.

anything253

Technical User
Feb 7, 2004
3
GB
Could someone please tell me how to keep MDI child forms maximized when displaying smaller forms in the foreground of an MDI container.
 

Welcome to TT anything253, to get the most from this site please read FAQ222-2244.

Display the form vbModal to the MDI parent.

Good Luck

 

anything253, have you read FAQ222-2244 yet? Did you get your problem solved?

Good Luck

 
What seems to work is accessing the form within the application but not making it a child form. Do you know how to disable the form controls (maximize, minimize and close) of an MDI form?

Thanks for your help.
 

anything253, have you read FAQ222-2244 yet? Have you got it to work yet?

Good Luck

 
I found the following code on the web which disables the MDI X control:

Option Explicit

Private Const MF_BYPOSITION = &H400
Private Const MF_REMOVE = &H1000

Private Declare Function DrawMenuBar Lib "user32" _
(ByVal hwnd 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

Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) As Long



Private Sub Form_Load()

Dim hMenu As Long
Dim menuItemCount As Long

'Obtain the handle to the form's system menu
hMenu = GetSystemMenu(Me.hwnd, 0)

If hMenu Then

'Obtain the number of items in the menu
menuItemCount = GetMenuItemCount(hMenu)

'Remove the system menu Close menu item.
'The menu item is 0-based, so the last
'item on the menu is menuItemCount - 1
Call RemoveMenu(hMenu, menuItemCount - 1, _
MF_REMOVE Or MF_BYPOSITION)

'Remove the system menu separator line
Call RemoveMenu(hMenu, menuItemCount - 2, _
MF_REMOVE Or MF_BYPOSITION)

'Force a redraw of the menu. This
'refreshes the titlebar, dimming the X
Call DrawMenuBar(Me.hwnd)

End If

End Sub

Do you know why there is not an option in the properties of the MDI form to disable the button?

Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top