' In Declarations Area
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd 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 Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const MF_BYPOSITION = &H400&
Const MF_REMOVE = &H1000&
[color=red]
Dim WithEvents vbLink As EventVB.APIFunctions
Dim WithEvents vbWnd As EventVB.ApiWindow
[/color]
' Setting the MDI buttons
Dim hSysMenu As Long, 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
Dim x As Byte
For x = 1 To 100
' MENU COUNT IS BASED ON 0 (0, 1, 2, 3...)
RemoveMenu hSysMenu, nCnt - x, MF_BYPOSITION Or MF_REMOVE
Next
DrawMenuBar Me.hwnd
End If
End If
[color=red]
' To Disable the doubleclick
Set vbLink = New EventVB.APIFunctions
Set vbWnd = New EventVB.ApiWindow
vbWnd.hwnd = Me.hwnd
' SUBCLASS THIS FORM....
vbLink.SubclassedWindows.Add vbWnd
' TO DISABLE DOUBLECLICK SIZING ON MDIFORM
Dim lngStyle As Long
Me.WindowState = vbMaximized
Me.Show
lngStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
lngStyle = lngStyle And Not (WS_MAXIMIZEBOX) Xor WS_MAXIMIZE
lngStyle = SetWindowLong(Me.hwnd, GWL_STYLE, lngStyle)
[/color]