Tuesday, June 12, 2012

Agar Form Tidak Bisa Digeser Atau Dipindahkan - VB6

Mengenai kode yang digunakan membekukan form agar tidak bisa digeser atau dipindahkan (move).
Option Explicit 

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
SC_MOVE = &HF010&
Public Const MF_BYCOMMAND = &H0&

Public Function
FrozeForm(frm As Form)
Dim lhSysMenu As Long
Dim
lRetVal As Long
lhSysMenu = GetSystemMenu(frm.hwnd, False)
lRetVal = RemoveMenu(lhSysMenu, SC_MOVE, MF_BYCOMMAND)
End Function
Contoh penggunaan kode di atas:
Private Sub Form_Load() 
FrozeForm Me
End Sub