Friday, 16 January 2015

Cara membuat Aplikasi hidden icon ketika di minimize pada vb6

berikut Cara membuat Aplikasi hidden icon ketika di minimize pada vb6 ,  ketika project sudah running dan si user menekan tombol minimize maka aplikasi kita masuk ke status bar/task bar  show hidden icon.

berikut cara nya

siapkan 2 form

form 1 = buat system try nya
form2 = menu utama nya

ini adalah codingan di form system try nya

Option Explicit

Private Type IconeTray
    cbSize As Long
    hWnd As Long
    uID As Long
    uFlags As Long
    uCallbackMessage As Long
    hIcon As Long
    szTip As String * 64
End Type
Dim IconeT As IconeTray

Private Const AJOUT = &H0
Private Const MODIF = &H1
Private Const SUPPRIME = &H2
Private Const MOUSEMOVE = &H200
Private Const MESSAGE = &H1
Private Const Icone = &H2
Private Const TIP = &H4

Private Const DOUBLE_CLICK_GAUCHE = &H203
Private Const BOUTON_GAUCHE_POUSSE = &H201
Private Const BOUTON_GAUCHE_LEVE = &H202
Private Const DOUBLE_CLICK_DROIT = &H206
Private Const BOUTON_DROIT_POUSSE = &H204
Private Const BOUTON_DROIT_LEVE = &H205
'API
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As IconeTray) As Boolean

Public Sub ToTray()
  IconeT.cbSize = Len(IconeT)
  IconeT.hWnd = Me.hWnd
  IconeT.uID = 1&
  IconeT.uFlags = Icone Or TIP Or MESSAGE
  IconeT.uCallbackMessage = MOUSEMOVE
  IconeT.hIcon = Image1.Picture
  IconeT.szTip = "Contoh Aplikasi System Try" & Chr$(0)
  Shell_NotifyIcon AJOUT, IconeT
  Me.Hide
  App.TaskVisible = False
End Sub
Public Sub ClearTray()
  IconeT.cbSize = Len(IconeT)
  IconeT.hWnd = Me.hWnd
  IconeT.uID = 1&
  Shell_NotifyIcon SUPPRIME, IconeT
End Sub


Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Static rec As Boolean, msg As Long
msg = x / Screen.TwipsPerPixelX
If rec = False Then
    rec = True
    Select Case msg
        Case DOUBLE_CLICK_GAUCHE:
         FUtama.WindowState = 0
                FUtama.Show
                ClearTray
           
        Case BOUTON_GAUCHE_POUSSE:
        Case BOUTON_GAUCHE_LEVE:
        Case DOUBLE_CLICK_DROIT:
        Case BOUTON_DROIT_POUSSE:
        Case BOUTON_DROIT_LEVE:
    End Select
    rec = False
End If

End Sub



lalu di form menut utama nya .
Private Sub Form_Resize()
  If FUtama.WindowState = 1 Then
     Me.Hide
     Fsystemtry.ToTray
   Else
     FUtama.Width = 8600
     FUtama.Height = 8100
   End If

End Sub



jika kurang mengerti
silahkan download project nya disini
http://www.4shared.com/zip/yyxJixWIce/Fsystem_try.html
Perhatian: Yuk Baca Artikel bagus di Nurul Musthofa

Artikel Terkait

No comments:

Post a Comment

 

Network

Pesan

Semoga situs ini bermanfaat