|
メニューを削除する方法はどうでしょうか。
Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function GetSystemMenu Lib "user32" _
(ByVal hWnd As Long, ByVal bRevert As Long) As Long
Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Const SC_MOVE = &HF010&
Const SC_SIZE = &HF000&
Const SC_MINIMIZE = &HF020&
Const SC_MAXIMIZE = &HF030&
Const SC_CLOSE = &HF060&
Const MF_BYPOSITION = &H400&
Const MF_BYCOMMAND = &H0&
Sub Test()
Dim hWnd As Long
Dim hMenu As Long
Dim Ret As Long
hWnd = FindWindow("XLMAIN", Application.Caption)
hMenu = GetSystemMenu(hWnd, 0)
Ret = RemoveMenu(hMenu, SC_MOVE, MF_BYCOMMAND)
Ret = RemoveMenu(hMenu, SC_SIZE, MF_BYCOMMAND)
Ret = RemoveMenu(hMenu, SC_MINIMIZE, MF_BYCOMMAND)
Ret = RemoveMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND)
Ret = DrawMenuBar(hWnd)
End Sub
Sub Test2()
Dim hWnd As Long
Dim hMenu As Long
hWnd = FindWindow("XLMAIN", Application.Caption)
hMenu = GetSystemMenu(hWnd, 1)
Ret = DrawMenuBar(hWnd)
End Sub
|
|