# 是VB的BUG吗??

Posted by Jack on August 18, 1999 at 23:38:42:

请问...我想要使MDIForm子表单右上角的[X]钮Disabled
但在MDI子表单为最大化时却没用..还是可以用右上角的[X]钮来关闭视窗
请问这是VB的BUG吗???

P.S:我要Disabale的是mdiform中的子表单

'抓取系统 Menu 的 hwnd
Private Declare Function GetSystemMenu Lib "user32" (ByVal _
hWnd As Integer, ByVal bRevert As Integer) As Integer

'移除系统 Menu 的 API
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Integer, ByVal nPosition As Integer, _
ByVal wFlags As Integer) As Integer
'第一个参数是系统 Menu 的 hwnd
'第二个参数是要移除选项的 Index

Const MF_BYPOSITION = &H400

Private Sub Form_Load()
SystemMenu% = GetSystemMenu(hWnd, 0)
Res% = RemoveMenu(SystemMenu%, 5, MF_BYPOSITION)
Res% = RemoveMenu(SystemMenu%, 5, MF_BYPOSITION)
End Sub

Follow Ups:

- 参考 cww 08:38:32 8/19/99 (1)
  - Re: 参考 Jack 21:41:10 8/19/99 (0)