EmersonH.Com

Transforming Knowledge into Power

  • Increase font size
  • Default font size
  • Decrease font size
Home VB.Net 2008 Form Making a form movable/unmovable

Making a form movable/unmovable

E-mail Print

Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Integer, ByVal nPosition As Integer,ByVal wFlags 1. As Integer) As
Public Declare Function GetSystemMenu Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal bRevert As Boolean) As IntPtr

Public Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Integer) As Integer

Public Const MF_DISABLED As Integer = &H2&
Public Const MF_BYPOSITION As Integer = &H400&

Public Function DisableMove(ByRef oForm As System.Windows.Forms.Form)
'
Call RemoveMenu(GetSystemMenu(oForm.Handle, False).ToInt32, 1, MF_DISABLED Or MF_BYPOSITION)
Call DrawMenuBar(oForm.Handle.ToInt32)
End Function

Last Updated on Monday, 21 December 2009 17:45