F
fpsoft
In Vs2005 i need to disable the Close button and remove Close Menu and then
reactivate them.
I have found how to disable Close button and remove close menu, but i
haven't found how to reactivate them.
Does someone knows how to reactivate them?
This is how i disable close button and remove close menu:
----
<DllImport("user32.dll")> Private Shared Function GetSystemMenu(ByVal hWnd
As IntPtr, ByVal wMsg As Boolean) As IntPtr
End Function
<DllImport("user32.dll")> Private Shared Function RemoveMenu(ByVal hWnd As
IntPtr, ByVal uPosition As Int32, ByVal uFlags As Int32) As Boolean
End Function
<DllImport("user32.dll")> Private Shared Function SendMessage(ByVal hWnd As
IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32)
As Int32
End Function
Private Const SC_CLOSE As Int32 = &HF060
Private Const MF_BYCOMMAND As Int32 = 0
Private Const WM_NCACTIVATE As Int32 = &H86
Private Sub DeactivateCloseButtonAndMenu()
Dim hMenu As IntPtr
hMenu = GetSystemMenu(Me.Handle, False)
RemoveMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
SendMessage(Me.Handle, WM_NCACTIVATE, 0, 0)
SendMessage(Me.Handle, WM_NCACTIVATE, 1, 0)
End Sub
reactivate them.
I have found how to disable Close button and remove close menu, but i
haven't found how to reactivate them.
Does someone knows how to reactivate them?
This is how i disable close button and remove close menu:
----
<DllImport("user32.dll")> Private Shared Function GetSystemMenu(ByVal hWnd
As IntPtr, ByVal wMsg As Boolean) As IntPtr
End Function
<DllImport("user32.dll")> Private Shared Function RemoveMenu(ByVal hWnd As
IntPtr, ByVal uPosition As Int32, ByVal uFlags As Int32) As Boolean
End Function
<DllImport("user32.dll")> Private Shared Function SendMessage(ByVal hWnd As
IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32)
As Int32
End Function
Private Const SC_CLOSE As Int32 = &HF060
Private Const MF_BYCOMMAND As Int32 = 0
Private Const WM_NCACTIVATE As Int32 = &H86
Private Sub DeactivateCloseButtonAndMenu()
Dim hMenu As IntPtr
hMenu = GetSystemMenu(Me.Handle, False)
RemoveMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
SendMessage(Me.Handle, WM_NCACTIVATE, 0, 0)
SendMessage(Me.Handle, WM_NCACTIVATE, 1, 0)
End Sub