Module Pendukung

Ini adalah module pendukung lainnya buat di file module baru jangan di campur dengan main module (yakin error wkwkkw)...



Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
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 SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Sub Fade1(Form As Form)
Dim Alpha As Byte
Dim Delay As Single
Do
    Delay = Timer
    Do While (Timer - Delay) < 0.01
        DoEvents
    Loop
    Alpha = Alpha + 5
    SetLayeredWindowAttributes Form.hWnd, 0, Alpha, LWA_ALPHA
Loop Until Alpha = 255
End Sub

Sub Fade2(Form As Form)
    Dim Ret As Long
    Ret = GetWindowLong(Form.hWnd, GWL_EXSTYLE)
    Ret = Ret Or WS_EX_LAYERED
    SetWindowLong Form.hWnd, GWL_EXSTYLE, Ret
End Sub

Sub CekForm(Form As Form, TxtID As String)
SQL = "select codes from FormX where formName='" & Form.Name & "'"
Set RSFind = DbCon.Execute(SQL)
If RSFind.RecordCount = 0 Then
    Form.Hide
    MsgBox "Form Is Not Valid!!!", vbCritical
    FrmDataForm.Show
    FrmDataForm.CmdAdd_Click
    FrmDataForm.TxtFormID = TxtID
    FrmDataForm.TxtFormID.Locked = True
    FrmDataForm.TxtFormName = Form.Name
    Unload Form
End If
End Sub


Sub Tombol(Form As Form, Stat As Boolean)
With Form
    .CmdAdd.Enabled = Stat
    .CmdEdit.Enabled = Stat
    .CmdDelete.Enabled = Stat
    .CmdSave.Enabled = Not Stat
    .CmdCancel.Enabled = Not Stat
End With
End Sub

Comments

Popular posts from this blog

Flowchart Penjualan Grosir / Eceran

Flowchart Proses Pembelian Barang