If so how ?
Thank you
Simon
You can try the following code:
Imports System.Runtime.InteropServices
Public Class Form1
Inherits System.Windows.Forms.Form
. . . . . .
. . . . . .
. . . . . .
<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 Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
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
End Class
Regards,
Elan Zhou
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? http://www.gotdotnet.com