Quote:
Originally Posted by aggieman122 why cant people play by the rulez. youre makin it harder on the fair people |
Then why the fuck are you on a cheating forum? xD
I made a minimize to tray tut
works for me
Note: This is NOT my source code. I only edited it...
OK, when I was first programming I tried minimize to tray. It didn't work because I kept on getting ambiguous file detected or some shit like that. This means 2 things are declared with the same name I think.
Now, minimize to tray and HTTPwrapper declared the same name.
So I changed the minimize to tray to say 2 for everything and got it to work
here is the tut
First, you will need
1 command button called cmdmin
The module I will give the source to
Now add a new module
Put this in the MODULES source
Code:
Code:
Public Type NOTIFYICONDATA2
cbSize As Long
hwnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Public Const NIM_ADD2 = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE2 = &H2
Public Const WM_MOUSEMOVE2 = &H200
Public Const NIF_MESSAGE2 = &H1
Public Const NIF_ICON2 = &H2
Public Const NIF_TIP2 = &H4
Public Const WM_LBUTTONDBLCLK2 = &H203
Public Const WM_LBUTTONDOWN2 = &H201
Public Const WM_LBUTTONUP2 = &H202
Public Const WM_RBUTTONDBLCLK2 = &H206
Public Const WM_RBUTTONDOWN2 = &H204
Public Const WM_RBUTTONUP2 = &H205
Public Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA2) As Boolean
Then, declare this at the very top of your code
Code:
Code:
Dim nid As NOTIFYICONDATA2
lol...remember that I changed the code to have 2 so it is not the same name as the wrapper lol
next add this
Code:
Code:
Sub minimize_to_tray()
Me.Hide
nid.cbSize = Len(nid)
nid.hwnd = Me.hwnd
nid.uId = vbNull
nid.uFlags = NIF_ICON2 Or NIF_TIP2 Or NIF_MESSAGE2
nid.uCallBackMessage = WM_MOUSEMOVE2
nid.hIcon = Me.Icon
nid.szTip = "Violent_J's alarm Clock" & vbNullChar
Shell_NotifyIcon NIM_ADD2, nid
End Sub
The nidsztip will be showed when you hoverover the Icon. For now, it will say "Violent_J's alarm clock" until you change it to th name of your own program!
Now, add this code
Code:
Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim msg As Long
Dim sFilter As String
msg = x / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDOWN2
Me.Show ' show form
Shell_NotifyIcon NIM_DELETE2, nid ' del tray icon
Case WM_LBUTTONUP2
Case WM_LBUTTONDBLCLK2
Case WM_RBUTTONDOWN2
Case WM_RBUTTONUP2
Me.Show
Shell_NotifyIcon NIM_DELETE2, nid
Case WM_RBUTTONDBLCLK2
End Select
End Sub
This is the mouse move and shiz
Now add the command button that will minimize it to tray
Code:
Private sub cmdmin_click()
minimize_to_tray
end sub
EDIT:
You must also add
Code:
Shell_NotifyIcon NIM_DELETE, nid
In your form unload cancel as integer code
here is mine for you to use
Code:
Private Sub Form_Unload(Cancel As Integer)
Shell_NotifyIcon NIM_DELETE, nid ' del tray icon
Dim frmTemp As Form
For Each frmTemp In Forms
Unload frmTemp
Set frmTemp = Nothing
Next
End
End Sub Enjoy minimize to tray in your programs