# Re: 表单之BorderStyle=2(大小可调整)，MaxButton=False时如何使表单不可调整大小？

Posted by Mouse on October 30, 1999 at 00:27:49:

In Reply to: 表单之BorderStyle=2(大小可调整)，MaxButton=False时如何使表单不可调整大小？ posted by 初学者 on October 29, 1999 at 10:23:36:

hMenu = GetSystemMenu(Me.hwnd, 0)
'设定大小不可使用
MII.cbSize = Len(MII)
MII.dwTypeData = String(80, 0)
MII.cch = Len(MII.dwTypeData)
MII.fMask = MIIM_STATE
MII.wID = SC_SIZE
GetMenuItemInfo hMenu, SC_SIZE, False, MII
MII.wID = 12&
MII.fMask = MIIM_ID
SetMenuItemInfo hMenu, SC_SIZE, False, MII
MII.fState = MII.fState Or MFS_GRAYED
MII.fMask = MIIM_STATE
SetMenuItemInfo hMenu, MII.wID, False, MII
SendMessage Me.hwnd, WM_NCACTIVATE, True, ByVal 0&

Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Declare Function GetMenuItemInfo Lib "user32" Alias "GetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal b As Boolean, lpMenuItemInfo As MENUITEMINFO) As Long
Declare Function SetMenuItemInfo Lib "user32" Alias "SetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal bool As Boolean, lpcMenuItemInfo As MENUITEMINFO) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Follow Ups: