Article ID: 110309
Article Last Modified on 10/29/2003
Restore
Move
Size
Minimize
Maximize
-----------------------
Close Alt+F4
-----------------------
Switch to... Ctrl+Esc
Sub Form_Load ()
Dim hSysMenu%, r%, j%, dw&, rr&
Const MF_BYPOSITION = &H400
' Set the default size of the form:
Form1.Height = Screen.Height + 45 ' Works on VGA.
Form1.Width = Screen.Width + 60 ' Works on VGA.
Form1.Left = -15 ' Works on VGA.
Form1.Top = -15 ' Works on VGA.
hSysMenu = GetSystemMenu(Form1.hWnd, 0)
For j = 8 To 4 Step -1
r = RemoveMenu(hSysMenu, j, MF_BYPOSITION)
Next j
For j = 2 To 1 Step -1
r = RemoveMenu(hSysMenu, j, MF_BYPOSITION)
Next j
' Leave Restore and Minimize in the Control-menu box.
dw& = GetWindowLong(Form1.hWnd, -16) 'Window style
dw& = dw& And &HFFFEFFFF 'Turn off Maximize button
rr& = SetWindowLong(Form1.hWnd, -16, dw&)
End Sub
Sub Command1_Click ()
End
End Sub
This button lets you end the program because Close is removed from the
Control-menu box.
' Enter each of the following Declare statements as one, single line:
Declare Function RemoveMenu% Lib "User" (ByVal hMenu%, ByVal nPosition%,
ByVal wFlags%)
Declare Function GetSystemMenu% Lib "User" (ByVal hWnd%, ByVal revert%)
Declare Function GetWindowLong Lib "User" (ByVal hWnd As Integer,
ByVal nIndex As Integer) As Long
Declare Function SetWindowLong Lib "User" (ByVal hWnd As Integer,
ByVal nIndex As Integer, ByVal dwNewLong As Long) As Long
Additional query words: buglist2.00 fixlist3.00 2.00
Keywords: kbbug kbfix KB110309