|
こんばんわ。
API使わんと無理やと思うねんけど・・・
使ってええんやったら、こんな感じかな?
(標準モジュール)
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex 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
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Sub EnableMaxButton(ByVal Flg As Boolean)
Dim Ret As Long
Dim hWnd As Long
Dim Wnd_STYLE As Long
hWnd = FindWindow("XLMAIN", Application.Caption)
Wnd_STYLE = GetWindowLong(hWnd, GWL_STYLE)
If Flg Then
Wnd_STYLE = Wnd_STYLE Or WS_MAXIMIZEBOX
Else
Wnd_STYLE = Wnd_STYLE And Not WS_MAXIMIZEBOX
End If
Ret = SetWindowLong(hWnd, GWL_STYLE, Wnd_STYLE)
Ret = DrawMenuBar(hWnd)
End Sub
Sub test()
MsgBox "無効にします"
EnableMaxButton False
MsgBox "有効にします"
EnableMaxButton True
End Sub
試してみてな。
ほな。
|
|