General information
Category:
Coding, syntax & commands
Christian,
Of course you can take the entire control box off, but if you want to leave
it on for min & max and disable close, you can use the following sub passing the Me.hWnd handle for the form (Calvin and gang have spoiled us VFP'ers by putting all this code under the hood in VFP)...
' API calls to disable form close item
Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Public Const MF_BYPOSITION = &H400&
Sub RemoveCloseItem(hWnd as long)
Dim hSysMenu as Long
' Get the system menu for the form
hSysMenu = GetSystemMenu(hWnd, 0)
' Remove the close item
Call RemoveMenu(hSysMenu, 6, MF_BYPOSITION)
' and the seperator
Call RemoveMenu(hSysMenu, 5, MF_BYPOSITION)
End Sub
>HI,
>I need a way to programmatically make a form unclosable (disabling the small x in the upper right corner). In VFP, I simply issue ThisForm.Closable = .F.. How can I do the trick in VB ?
>
>Thank you for your help,
>Christian Cote
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only