|
Private Declare Function FindWindow _
Lib "User32" Alias "FindWindowA" _
(ByVal lpClassName As String _
, ByVal lpWindowName As String) As Long
Private Declare Function GetSystemMenu Lib "User32" _
(ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Sub DeleteMenu Lib "User32" _
(ByVal hMenu As Long, ByVal nPosition As Long _
, ByVal wFlags As Long)
Private Declare Function DrawMenuBar Lib "User32" _
(ByVal hWnd As Long) As Long
Private Const SC_CLOSE As Long = &HF060&
Private Const MF_BYCOMMAND = &H0&
Sub sample()
Dim myHwnd As Long
Dim myHMenu As Long
myHwnd = FindWindow("XLMAIN", Application.Caption)
myHMenu = GetSystemMenu(myHwnd, 0)
If myHMenu <> 0& Then
DeleteMenu myHMenu, SC_CLOSE, MF_BYCOMMAND
End If
DrawMenuBar myHwnd
End Sub
---------------
Private Declare Function FindWindow Lib "User32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
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 DrawMenuBar Lib "User32" _
(ByVal hWnd As Long) As Long
Const WS_SYSMENU As Long = &H80000
Const GWL_STYLE As Long = -16
Sub sample2()
Dim hWnd As Long, lStyle As Long
hWnd = FindWindow("XLMAIN", Application.Caption)
lStyle = GetWindowLong(hWnd, GWL_STYLE)
lStyle = lStyle And Not WS_SYSMENU
SetWindowLong hWnd, GWL_STYLE, lStyle
DrawMenuBar hWnd
End Sub
---------------
Sub Sample3()
ThisWorkbook.Protect Windows:=True
End Sub
---------------
Sub Sample4()
Application.DisplayFullScreen = True
End Sub
ユーザーフォームで入力画面を作った方が良い気もしますが・・・
|
|