展开全部
VB6.0让窗体右上角的X关闭按钮失效(禁止窗体右上角的上关闭按钮)
新建一个工程,什么也不用做,直接把这写代码复制粘贴到工程代码里就行,运行看!
Option
Explicit
Private
Declare
Function
DeleteMenu
Lib
"user32"
(ByVal
hMenu
As
Long,
ByVal
nPosition
As
Long,
ByVal
wFlags
As
Long)
As
Long
Private
Declare
Function
GetMenuItemCount
Lib
"user32"
(ByVal
hMenu
As
Long)
As
Long
Private
Declare
Function
GetSystemMenu
Lib
"user32"
(ByVal
hwnd
As
Long,
ByVal
bRevert
As
Long)
As
Long
Const
HWND_TOPMOST
=
-1
'让X为假值
Const
SWP_SHOWWINDOW
=
&H40
Private
Const
DJ_BYPOSITION
=
&H400&
Private
Sub
Form_Load()
Dim
hwndMenu
As
Long
Dim
c
As
Long
hwndMenu
=
GetSystemMenu(Me.hwnd,
0)
c
=
GetMenuItemCount(hwndMenu)
DeleteMenu
hwndMenu,
c
-
1,
DJ_BYPOSITION
End
Sub
新建一个工程,什么也不用做,直接把这写代码复制粘贴到工程代码里就行,运行看!
Option
Explicit
Private
Declare
Function
DeleteMenu
Lib
"user32"
(ByVal
hMenu
As
Long,
ByVal
nPosition
As
Long,
ByVal
wFlags
As
Long)
As
Long
Private
Declare
Function
GetMenuItemCount
Lib
"user32"
(ByVal
hMenu
As
Long)
As
Long
Private
Declare
Function
GetSystemMenu
Lib
"user32"
(ByVal
hwnd
As
Long,
ByVal
bRevert
As
Long)
As
Long
Const
HWND_TOPMOST
=
-1
'让X为假值
Const
SWP_SHOWWINDOW
=
&H40
Private
Const
DJ_BYPOSITION
=
&H400&
Private
Sub
Form_Load()
Dim
hwndMenu
As
Long
Dim
c
As
Long
hwndMenu
=
GetSystemMenu(Me.hwnd,
0)
c
=
GetMenuItemCount(hwndMenu)
DeleteMenu
hwndMenu,
c
-
1,
DJ_BYPOSITION
End
Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询