Minimize Form ke System Tray di Taskbar

Forum diskusi pemrograman VB6

Minimize Form ke System Tray di Taskbar

Postby anrich » 18 Feb 2012, 10:22

hallo Master semuanya, apakah ada yg punya source code buat kirim / Hide ke System Tray di Taskbar ketika user klik Minimize di Form, dan setelah Form di Tutup / Exit, gambar icon di system tray nya lagsung hilang dlm sekejap, tidak seperti koding saya yg masih lengket walaupun uda exit, tapi harus di dekatin pake mouse baru hilang tuh icon di system tray at taksbar :-s .

Trims sbelumnya
anrich
Prajurit Dua
Prajurit Dua
 
Posts: 11
Joined: 31 Jan 2012, 13:40
Memberi kopi: 0 cangkir
Mendapat kopi: 0 cangkir

Re: Minimize Form ke System Tray di Taskbar

Postby Djuliar » 18 Feb 2012, 23:56

saya coba memberi bantuan ya?
coba yang ini systray biasa...
Klo anda memakai sysTray milik osenXp biasanya emang masih ada tu ketika aplikasi dah mati...
matikan aja dahulu Systray.Remove

<:D> <:D> <:D>
You do not have the required permissions to view the files attached to this post.
User avatar
Djuliar
Prajurit Satu
Prajurit Satu
 
Posts: 132
Joined: 08 Jan 2011, 18:28
Location: Jember
Memberi kopi: 7 cangkir
Mendapat kopi: 39 cangkir

Re: Minimize Form ke System Tray di Taskbar

Postby PutraVB » 19 Feb 2012, 00:17

Saya jg punya contoh source code-nya
http://putravb.blogspot.com/2010/06/tray-icon.html
PutraVB
Prajurit Satu
Prajurit Satu
 
Posts: 59
Joined: 09 Jun 2010, 02:43
Memberi kopi: 0 cangkir
Mendapat kopi: 6 cangkir

Re: Minimize Form ke System Tray di Taskbar

Postby Gyus » 19 Feb 2012, 01:36

anrich wrote:hallo Master semuanya, apakah ada yg punya source code buat kirim / Hide ke System Tray di Taskbar ketika user klik Minimize di Form, dan setelah Form di Tutup / Exit, gambar icon di system tray nya lagsung hilang dlm sekejap, tidak seperti koding saya yg masih lengket walaupun uda exit, tapi harus di dekatin pake mouse baru hilang tuh icon di system tray at taksbar :-s .

Trims sbelumnya

coba di posting source code na.. pasti ada yg kurang tuh... contohnya byk di google.. tapi udah dikasih tuh sama Oom2 Djuliar n PutraVB :-bd
ImageImage
User avatar
Gyus
Global Moderator
Global Moderator
 
Posts: 1172
Joined: 19 Mar 2010, 20:33
Location: Jakarta Timur - Indonesia
Memberi kopi: 25 cangkir
Mendapat kopi: 84 cangkir

Re: Minimize Form ke System Tray di Taskbar

Postby anrich » 20 Feb 2012, 15:27

Trims buat om Djuliar & PutraVB atas source codenya.. :-*
buat om Gyus, saya sertakan source codenya di bawah ini, dpt dari googling jg :D

--------
Modul :
--------
'user defined type required by Shell_NotifyIcon API call
Public Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String * 64
End Type

'constants required by Shell_NotifyIcon API call:
Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4
Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDOWN = &H201 'Button down
Public Const WM_LBUTTONUP = &H202 'Button up
Public Const WM_LBUTTONDBLCLK = &H203 'Double-click
Public Const WM_RBUTTONDOWN = &H204 'Button down
Public Const WM_RBUTTONUP = &H205 'Button up
Public Const WM_RBUTTONDBLCLK = &H206 'Double-click

Public Declare Function SetForegroundWindow Lib "user32" _
(ByVal hwnd As Long) As Long
Public Declare Function Shell_NotifyIcon Lib "shell32" _
Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean

Public nid As NOTIFYICONDATA


----------------
Form_Load
----------------
Me.Show
Me.Refresh
With nid
.cbSize = Len(nid)
.hwnd = Me.hwnd
.uId = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallBackMessage = WM_MOUSEMOVE
.hIcon = Me.Icon
.szTip = "Program Aplikasi ..... " & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, nid


---------------------
Form_MouseMove
---------------------

Dim Result As Long
Dim msg As Long

'the value of X will vary depending upon the scalemode setting
If Me.ScaleMode = vbPixels Then
msg = X
Else
msg = X / Screen.TwipsPerPixelX
End If
Select Case msg
Case WM_LBUTTONUP '514 restore form window
Me.WindowState = vbNormal
Result = SetForegroundWindow(Me.hwnd)
Me.Show
Case WM_LBUTTONDBLCLK '515 restore form window
Me.WindowState = vbNormal
Result = SetForegroundWindow(Me.hwnd)
Me.Show
Case WM_RBUTTONUP '517 display popup menu
Result = SetForegroundWindow(Me.hwnd)
Me.PopupMenu Me.mPopupSys
End Select

Private Sub mPopExit_Click()
'called when user clicks the popup menu Exit command
Dim jwb As String
jwb = MsgBox("Anda yakin ingin keluar dari Program Aplikasi ? ", vbQuestion + vbYesNo, "Exit to Windows")
If jwb = vbYes Then
End
End If
End Sub

Private Sub mPopRestore_Click()
'called when the user clicks the popup menu Restore command
Dim Result As Long
Me.WindowState = vbMaximized
Result = SetForegroundWindow(Me.hwnd)
Me.Show
End Sub

---------------------------------
Form Unload / Terminate :
---------------------------------
Shell_NotifyIcon NIM_DELETE, nid

Form_Resize atau klik tombol Hide to SysTray, hny menggunakan perintah Me.Hide
Karena Form yg saya gunakan hny satu, dan itu pun Border-Style = 0-None, kemudian user jg bisa pindah task seperti ke ms. excel atau explorer dgn tekan tombol ALT + TAB.

Mohon koreksi atas coding saya diatas ya Master <:D>

Trims
anrich
Prajurit Dua
Prajurit Dua
 
Posts: 11
Joined: 31 Jan 2012, 13:40
Memberi kopi: 0 cangkir
Mendapat kopi: 0 cangkir

Re: Minimize Form ke System Tray di Taskbar

Postby Gyus » 22 Feb 2012, 02:29

ok boz @anrich .. dach cukup coding na ^:)^ tapi saran saia sih klo bisa dibuat UserControl aja untuk System Tray Icon na :D
Download: TRAY AREA
ImageImage
User avatar
Gyus
Global Moderator
Global Moderator
 
Posts: 1172
Joined: 19 Mar 2010, 20:33
Location: Jakarta Timur - Indonesia
Memberi kopi: 25 cangkir
Mendapat kopi: 84 cangkir

Re: Minimize Form ke System Tray di Taskbar

Postby anrich » 22 Feb 2012, 16:07

Ok trims Oom Gyus ;)
ntar ta' coba dulu UserControl (Tray Area) nya, btw complete jg source codenya di http://www.andreavb.com/ :D
anrich
Prajurit Dua
Prajurit Dua
 
Posts: 11
Joined: 31 Jan 2012, 13:40
Memberi kopi: 0 cangkir
Mendapat kopi: 0 cangkir


Return to Visual Basic 6.0

Who is online

Users browsing this forum: No registered users and 2 guests