Menghilangkan Tombol Minimize, Maximize dan Close pada Form

Source code berikut untuk menyembunyikan seluruh tombol pada form sebelah kanan bagian atas terdapat 3 tombol, yaitu: tombol max, tombol min, dan tombol close dengan menggunakan fungsi API.


Buat 1 project dengan :
1 Form

Copy source code berikut pada Form :
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  
Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)
Const WS_SYSMENU = &H80000
 
Private Sub Form_Load()
    Dim l As Long
    l = GetWindowLong(Me.hwnd, GWL_STYLE)
    l = (l And Not WS_SYSMENU)
    l = SetWindowLong(Me.hwnd, GWL_STYLE, l)
End Sub

DOWNLOAD Full Source Project
Comments
0 Comments

0 comments:

Post a Comment