|
-
Nov 1st, 2000, 06:15 AM
#1
Thread Starter
Hyperactive Member
Hi,
I have a small utility that when executed is placed in the Systray. The program has 2 systray icons that can change depending on the if statement below, ie:
Code:
If p1 = True Or p2 = True Or p5 = True Or p6 = True Then
prstatus = "Running : " + prstat & Chr(0)
With tTrayIcon
.hIcon = press1go.Picture
.szTip = prstatus
End With
Else
prstatus = Trim("Not Running!")
With tTrayIcon
.hIcon = press1stop.Picture
.szTip = prstatus & Chr(0)
End With
End If
Shell_NotifyIcon &H1, tTrayIcon
The problem is that when the Shell_Notifyicon command is executed, the systray refreshes but takes focus from any other application in the foreground, meaning, the a user must click they're own application to bring it back to the foreground.
I should also mention that I've made the application "Allows on Top" using
Code:
res& = SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
Can anyone tell me how I can get the program to refresh in background stoping the program from taking focus?
Thanks
Craig.
-
Nov 1st, 2000, 07:30 AM
#2
SetForegroundWindow?
^Try using this maybe.
Code:
Public Declare Function SetForegroundWindow _
Lib "user32" (ByVal hwnd As Long) As Long
Usage
SetForegroundWindow Me.hWnd
Sorry if I'm not correct, but I am confused with this line:
Can anyone tell me how I can get the program to refresh in background stoping the program from taking focus?
-
Nov 1st, 2000, 08:02 AM
#3
Thread Starter
Hyperactive Member
Thanks Matthew,
I don't understand where I would use this line.
What I mean is that, the Refresh procedure is set on a timer (60secs) and when ran, the procedure will run the "if" statement and then changes the icon as neccesary.
BUT, when the icon is updated in the systray, the program will take Focus away from any other application running, i.e (Word,Excel).
The user could be typing in word when all of a sudden the application loses focus to the small app in the systray.
Does this help?
Cheers,
Craig.
-
Nov 3rd, 2000, 10:12 AM
#4
Thread Starter
Hyperactive Member
Can someone please help me with this?
Regards,
Craig.
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
|