|
-
Dec 11th, 2000, 11:16 AM
#1
Thread Starter
Addicted Member
Hello,
Okay a couple things i need help on.
When my program in minimized I want the icon for the app to be placed in the lower right hand corner of the screen ( I dont think its called the tasbar, but anyway )so i need help on that.
Second, I tried setting the icon to the form in code>
frmmain.icon = app.path & "\binoculr.ico"
But that doesnt work either.
Thanks .
-
Dec 11th, 2000, 11:21 AM
#2
Do you mean next to the clock?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Dec 11th, 2000, 11:32 AM
#3
Thread Starter
Addicted Member
Yes that is it
-
Dec 11th, 2000, 11:46 AM
#4
Try this..
Follow this link...this should get you going
http://www.vbsquare.com/tips/tip178.html

JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Dec 11th, 2000, 12:22 PM
#5
Thread Starter
Addicted Member
okay i keep getting error message on
here is the full code i am using.
Code:
Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Public Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
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_LBUTTONUP = &H202
Public Const WM_RBUTTONUP = &H205
Public Const WM_MOUSEMOVE = &H200
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
Public VBGTray As NOTIFYICONDATA
Private Sub GoSystemTray()
VBGTray.cbSize = Len(VBGTray)
VBGTray.hwnd = Me.hwnd
VBGTray.uId = vbNull
VBGTray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
VBGTray.ucallbackMessage = WM_MOUSEMOVE
VBGTray.hIcon = Me.Icon
'tool tip text
VBGTray.szTip = Me.Caption & vbNullChar
Call Shell_NotifyIcon(NIM_ADD, VBGTray)
App.TaskVisible = False 'remove application from taskbar
Me.Hide
End Sub
Private Sub Form_MouseMove(button As Integer, Shift As Integer, X As Single, Y As Single)
Static lngMsg As Long
Static blnFlag As Boolean
Dim result As Long
lngMsg = X / Screen.TwipsPerPixelX
If blnFlag = False Then
blnFlag = True
Select Case lngMsg
'right-click
Case WM_RBUTTONUP
result = SetForegroundWindow(Me.hwnd)
PopupMenu frmMain
Case WM_LBUTTONUP
result = SetForegroundWindow(Me.hwnd)
c
End Select
blnFlag = False
End If
End Sub
Private Sub Form_Resize()
If Me.WindowState = 1 Then
Call GoSystemTray
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
VBGTray.cbSize = Len(VBGTray)
VBGTray.hwnd = Me.hwnd
VBGTray.uId = vbNull
Call Shell_NotifyIcon(NIM_DELETE, VBGTray)
End Sub
Any help would be great.
Thanks
ps. I tried using PopupMenu mypopupmenu but that error'd as well.
-
Dec 11th, 2000, 12:23 PM
#6
Frenzied Member
and for loading your icon at runtime:
Code:
frmmain.icon = loadpicture(app.path & "\binoculr.ico")
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Dec 11th, 2000, 12:25 PM
#7
Frenzied Member
Oh sorry didn't see your reply 
Doesn't work because frmMain is a form, and you need to pass a menu
Make a menu with the Menu Editor (CTRL + E) and call it
mnuPop
then replace
with
and all will be cool.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Dec 11th, 2000, 12:37 PM
#8
Thread Starter
Addicted Member
okay Jop getting closer.
Now when I click on the icon in systray it brings up a sub menu which i made.
What code do i put in the submenu click event??
So far i tried.
frmmain.show
frmmain.visible=true
But none work.
Help
-
Dec 11th, 2000, 12:40 PM
#9
Frenzied Member
What code do i put in the submenu click event??
Well that depends on what you want to do 
I assume you have minimized the form and set it's visible property to false?
try this
Code:
Private Sub mnuPop_Click()
Form1.Windowstate = 0
Form1.Visible = True
End Sub
did that work?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Dec 11th, 2000, 12:43 PM
#10
Thread Starter
Addicted Member
Yes Jop that did work.
I dont know why I didnt think about the window state.
I got all caught up in the icon that i forgot what I was really doing which was minimizing the form.
But thanks again Jop and everyone else.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|