Menonaktifkan Tombol Close Pada Visual Basic 6.0


disuruh ama teman membuat program yang tidak bisa diclose

akhirnya nyari di google dan ketemu sama artikel teman saya

tanpa basa basi saya coba dan berhasil

berikut kutipan kodenya:

1. buat sebuah modul baru, nama terserah anda

2. tambahkank kode berikut:

Private Declare Function GetSystemMenu Lib “user32” (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib “user32” (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long

Public Sub DisableCloseBtn(ByVal Frm As Form)
Dim h As Long
h = GetSystemMenu(Frm.hwnd, 0)
RemoveMenu h, 6, &H400
RemoveMenu h, 5, &H400
End Sub

3. lalu tambahkan kode berikut pada form_load()

DisableCloseBtn Me

maka saat form dijalankan tombol close tidak akan berfungsi

nah, untuk bisa diclose, tambah event lain misalnya pada command1:

Private Sub Command1_Click()
End
End Sub

happy coding..😀

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s