|
-
Apr 20th, 2000, 10:35 AM
#1
Hello,
Dose anybody know the API call to disable the Maximize button on a MDI form. I have spent 21/2 hours searching through the MSDS Library and I have absolutely no luck at all.
Thank you in advance,
Roger
-
Apr 20th, 2000, 11:48 AM
#2
Need-a-life Member
You can eliminate the command of "maximize" from the popup menu of your task. You could also do it with the "minimize", "close", etc.
Code:
Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Public Const MF_BYPOSITION = &H400&
Public Const MF_REMOVE = &H1000&
Sub NoMaximize()
Dim hSysMenu As Long
Dim nCnt As Long
' Get handle to our form's system menu
' (Restore, Maximize, Move, close etc.)
hSysMenu = GetSystemMenu(Me.hwnd, False)
If hSysMenu Then
' Get System menu's menu count\
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
' Menu count is based on 0 (0, 1, 2, 3...)
RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE 'Remove the close
RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE ' Remove el separator (--------)
RemoveMenu hSysMenu, nCnt - 3, MF_BYPOSITION Or MF_REMOVE ' Remove the maximize
RemoveMenu hSysMenu, nCnt - 4, MF_BYPOSITION Or MF_REMOVE ' Remove the minimize
RemoveMenu hSysMenu, nCnt - 5, MF_BYPOSITION Or MF_REMOVE ' Remove the size
RemoveMenu hSysMenu, nCnt - 6, MF_BYPOSITION Or MF_REMOVE ' Remove the move
DrawMenuBar Me.hwnd
End If
End If
end sub
Hope this was what you were looking for, and get it work. It really works, but don't know if I forgot to paste some other declaration, or something.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Apr 20th, 2000, 11:58 AM
#3
-
Apr 20th, 2000, 08:01 PM
#4
Hello Mc Brain,
Thank you very very much!
I will give it a go.
Thank you again.
Roger
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|