|
发表于 2024-8-21 16:06
来自手机
|
显示全部楼层
本帖最后由 lss001 于 2024-8-21 20:34 编辑
'以下代码请放置在窗体中
Private Declare PtrSafe Function FindWindow _
Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function GetWindowLong _
Lib "user32" Alias "GetWindowLongA" ( _
ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLong _
Lib "user32" Alias "SetWindowLongA" ( _
ByVal hwnd As LongPtr, ByVal nIndex As Long, _
ByVal dwNewLong As LongPtr) As LongPtr
Private Declare PtrSafe Function DrawMenuBar _
Lib "user32" (ByVal hwnd As LongPtr) As Long
Private FHwnd As LongPtr
Private Ft As LongPtr
Private Const GWL_STYLE = (-16)
Private Const WS_SYSMENU= &H80000
Private Sub UserForm_Initialize()
FHwnd = FindWindow("ThunderDFrame", Me.Caption)
Ft = GetWindowLong(FHwnd, GWL_STYLE)
'X关闭按钮X
Ft = Ft And Not WS_SYSMENU
SetWindowLong FHwnd, GWL_STYLE, Ft
DrawMenuBar FHwnd
End Sub |
|