Dezactiveaza "X"

Programare in Visual Basic 5/6
Visual Basic 5/6 programming

Dezactiveaza "X"

Post Number:#1  Postby freshmeat » 09 Nov 2012 11:53

Dezactiveaza butonul "X" din titlebarul unui form :

Code: Select all
Private Declare Function GetSystemMenu _
                Lib "User32" (ByVal hwnd As Long, _
                              ByVal bRevert As Long) As Long

Private Declare Function GetMenuItemCount Lib "User32" (ByVal hMenu As Long) As Long

Private Declare Function RemoveMenu _
                Lib "User32" (ByVal hMenu As Long, _
                              ByVal nPosition As Long, _
                              ByVal wFlags As Long) As Long

Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As Long) As Long

Private Const MF_BYPOSITION = &H400&

Private Const MF_DISABLED = &H2&
   
Public Function Disable_Button_X(frm As Form)

    Dim hMenu  As Long

    Dim nCount As Long

    hMenu = GetSystemMenu(frm.hwnd, 0)
    nCount = GetMenuItemCount(hMenu)
    Call RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION)
    DrawMenuBar frm.hwnd
End Function

User avatar
freshmeat
Mediu
Mediu
Progress to next rank:
36%
 
Status: Offline
Posts: 68
Age: 31
Joined: 08 Nov 2012 10:24
Location: Romania

Invitations sent: 0
Referrals: 0
National Flag:
Romania
Local time: 24 Nov 2017 13:54
Has thanked: 10 times
Been thanked: 18 times

Return to Visual Basic

Who is online

Users browsing this forum: No registered users and 1 guest

cron