Cara Membuat Efek Google Talk pada Form di Visual Basic 6.0

Cara Membuat Efek Google Talk pada Form di Visual Basic 6.0 - Google Talk (GTalk) adalah suatu layanan aplikasi berbasis web dari Google yang dibuat sebagai sarana untuk berkomunikasi melalui pesan instan dan VoIP. Bagi Anda yang pernah melakukan komunikasi antar web pasti sudah tidak asing lagi bagaimana efek ini terjadi.Pada pertemuan kali ini Saya ingin berbagi trik bagaimana membuat efek google talk pada form, dimana  form akan muncul dari sudut kanan bawah komputer yang melayang secara halus.Bagi Anda yang penasaran bagaimana membuatnyamari kita ikuti langkah-langkah berikutdibawah ini:

Cara Membuat Efek Google Talk pada Form di Visual Basic 6.0

1. Buka Form VB6 Anda
2. Tambahkan 1 CommandButton pada form
3. Kemudian Anda ketik kode dibawah ini:


Const IDANI_OPEN = &H1

Const IDANI_CLOSE = &H2

Const IDANI_CAPTION = &H3

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal x2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DrawAnimatedRects Lib "user32" (ByVal hWnd As Long, ByVal idAni As Long, lprcFrom As RECT, lprcTo As RECT) As Long
Private Declare Function GetWindowRect Lib "user32.dll" (ByVal hWnd As Long, ByRef lpRect As RECT) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Public Sub ShowMinimzeToSysTray(ByVal hWnd As Long)
    Dim rSource As RECT, rDest As RECT
    GetWindowRect hWnd, rSource
    GetWindowRect FindWindowEx(FindWindow("Shell_TrayWnd", vbNullString), 0, "TrayNotifyWnd", vbNullString), rDest
    Call DrawAnimatedRects(hWnd, IDANI_CLOSE Or IDANI_CAPTION, rSource, rDest)
End Sub

Public Sub ShowRestoreFromSysTray(ByVal hWnd As Long)
    Dim rSource As RECT, rDest As RECT
    GetWindowRect FindWindowEx(FindWindow("Shell_TrayWnd", vbNullString), 0, "TrayNotifyWnd", vbNullString), rSource
    GetWindowRect hWnd, rDest
    Call DrawAnimatedRects(hWnd, IDANI_OPEN Or IDANI_CAPTION, rSource, rDest)
End Sub


Private Sub command1_Click()
    ShowMinimzeToSysTray hWnd
    Unload Me
End Sub

Private Sub Form_Load()
ShowRestoreFromSysTray Me.hWnd
End Sub


3.Simpan kode Anda dan jalankan program.

Demikian tip cara Cara Membuat Efek Google Talk pada Form di Visual Basic 6.0. Selamat mencoba semoga berhasil.

No comments: