WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Systray Icon Questions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Systray Icon Questions

Keywords: systray Task List winclose 

Question #1:

How do I kill a systray icon? I can do a CTRL-ALT-DEL and see the application in the task list and kill it there, but I cannot kill it with the WinCloseNot or WinClose functions. How can I do this?

Solution:

First run the following script to find the name of the application that you want to kill.

allwins = WinItemize()
htab = Num2Char(9)
n = ItemCount(allwins, htab)
For x = 1 to n
   win = ItemExtract(x, allwins, htab)
   message("Program Name", win)
next
After you've found the name of the application, add the following line to the script file you are creating.

Winclose("VshieldMonitor")

Question #2:

How do I get a Winbatch program to run in the SYSTEMTRAY in Windows 95 (like the popmenu.exe).

I think this may be more of a 95/NT question rather than a winbatch question. I know that the popup menu is there and I will look for it in the registry, but just wonder if there is anything special that I must do?

Answer:

Intcontrol 1007 (available in the 98 version of Winbatch) will do it, e.g.:


;This intcontrol puts script in systray and hides icon on taskbar 
IntControl(1007, 1, 1, "YooHoo", "")
while 1
   ;This intcontrol Suspends the script 
   ;until user clicks on the tray icon
   IntControl(1007, 3, 1, "", "") 
   Pause("BEEEP","Icon was clicked")
   ;do stuff here
endwhile
exit
 

Question (continued):

Is it that you CAN'T or WON'T support it?? I noticed that PopMenu goes in nicely. Why? Was it written in VB, or is there a special way to get it to go that is not documented.

Answer:

Popmenu was written in straight MS C as was designed to be a tray application. That was its purpose in life.

To take a random program and cajole it into going into the systray area is an entirely different task. It's something like...gee the clock is in there, how come I can't put Notepad in there.

One of our users reported having good fortune with a Freeware component called TRAY.EXE to load programs, including Winbatch compiled executables, into the System Tray.

The syntax is simple:


	Tray.EXE d:\path\executable.exe
It works in hidden mode---the new icon will appear in the tray.

To get a copy, you can write the author, Thomas Ronneberg of Norway, Thomas@intercom.no

Or, it can be found at the: Windows 95 Annoyances site, in the "Collected Windows95 Software" section. If you have VisualC++ there is some sample code that shows you how to do it.

Or, there's another third party utility that will do it, located at:

ICONCRRL.ZIP: Icon Corral 1.0i for Windows95.

Allows you to "hide" files over in the taskbar tray (where the clock is). Great for programs that are running all the time and usually minimized (like schedule plus). New version (Newest File Date: 03-08-96) ( 83015 bytes, Posted 03-30-96)

Here's another third party utility, EnTRAY, which lets you dynamically add and remove programs, documents and shortcuts to your system tray (Windows taskbar). These programs and documents can then be run from the tray through a single mouse click. In addition, EnTRAY also lets you minimize or maximize all windows through a single mouse-click by clicking on the EnTRAY icon itself.


http://www.bendigo.net.au/tucows/util95.html 

Select Menus Question:

How do I select menus of icons in Win 95 systray? How can I select menu items of a program that only runs as an icon in the tray on the Win95 task bar? I want to change video resolutions with the menu on my MGA Quickdesk icon (similar to Microsoft Quick Res)?

Answer:

... With great difficulty. No one has come up with a good solution.

The only one I've see is to MouseMove the mouse on top of the systray icon and then MouseClick it. Once the menu pops up normal SendKeys can handle it.

The problem is that if the icons shift, then the script breaks.

The trick is getting the MouseMove co-ordinates correct so the MouseClick happens in the correct spot.

And you will need to use WinMetrics to check the current resolution to figure out what set of mousemove co-ordinates to use to move to, to change it.


WWWTray Connectoid Question:

How do I put an Internet connectoid on the tray using WWWTRAY? When I create a shortcut to a connectoid and go to modify its properties to add a WWWTRAY.EXE prefix, the TARGET field is inaccessible (grayed out). How do I get around this?

Answer:

Ummm. Some links are special, the dialup networking ones in particular. To run dialup networking from a WinBatch script - and assuming you do not want to use the Internet extender which can do this...
  1. Drag the dialup networking connectoid to a folder so it makes a shortcut to it.

  2. Use the following code to run the shortcut...
    
    mylink = "c:\win95\desktop\mynet.lnk"
    ;------------------------------------
    ShellExecute(mylink, "", "", @NORMAL, "")
    WinWaitExist("Connect To",-1))
    SendKeysto("Connect To","~")
    WinWaitClose("Connect To")
    
    PS. The WinWaitClose is VERY important.

  3. Also see Article ID# W13291.

Getting Systray Icon to Go Away after Killing Systray App

Question:

I discovered something that is very interesting. I am writing a program that will close down the Scheduling application associated with McAfee (avconsol.exe).While this application is running it is present on the System Tray. When you close it, using IntControl(56,"~McAfee",0,0,0) it still appears to be running because it is still present on the System Tray. But...if you move your cursor over the System Tray it disappears. If you just sit there without doing anything it takes a while for it to disappear. Any suggestions as to why this happens and how to make it disappear instantly????

Answer:

It really is gone. It is just that the system tray application has not bothered to update the tray display. You could try MouseMove and move the mouse over the system tray. Problem is that the MouseMove method generally only works for one computer but a user reported that the following works pretty well at various displays:

;Tried this at 640x480 800x600 and 1024x768
;Seems to work pretty good.

CurrLocn = MouseInfo(2)
Locn1 = ItemExtract(1, CurrLocn, " ")
Locn2 = ItemExtract(2, CurrLocn, " ")
For X = 800 to 1000
MouseMove(X , 970, "", "")
Next
MouseMove(Locn1, Locn2, "", "")

How to Find out if a Window is Generated from a Systray Icon App Question:

Is it possible to discern between windows generated by a systray icon versus a non-systray generated window in the winitemize list?

If not now, might there be a function in the future that could distinguish between those types of windows, or is there some other way to dynamically determine that?

Thanks.

Answer:

Depends. Hmmm.

WinExeName could be used to determine the exe of the owning window, and from that you could have a table of exe names.

There is no real way I know of to tell if a window comes from an application that may also have something in the systray.


Article ID:   W13463
Filename:   Systray Icon Questions.txt
File Created: 2001:01:26:15:04:12
Last Updated: 2001:01:26:15:04:12