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.

IntControl 1007 Change Icon

 Keywords:  IntControl 1007 Change Icon .ICO 

Question:

I don't get it. I created an .ico file with multiple images in it. I'm compiling a program to use the .ico file, and it doesn't complain (about deleting any icons, so I assume it sees 6 "valid" images) so I assume those icons are available. My code is switching the icon based on status. However, the icon in the system tray isn't changing. My testing code is as follows, where I cycle through all "embedded" icons:
 IntControl(1007, 1, 1, '', '') 
 for x=0 to 8
  Click=IntControl(1007, 4, 2, '', 'c:\myicon.ico|%x%') 
  Message(x,'Click')
 next
 
But the icon never changes. Why?

Answer:

The value passed to IntControl 1007 can be an .ICO file, or an .EXE or .DLL (or similar resource file) containing icons.

An .ICO file only contains a single 'Icon Group' (with multiple icon images) . It is completely up to Windows to decide which icon image is displayed in the task bar.

Icons are stored in .DLL and .EXE files in 'Icon Groups'. Each 'Icon Group' can contain multiple icon images, each with a different size and/or color depth.

If you pass IntControl 1007 a resource (EXE or DLL) containing multiple 'Icon groups', you can specify a different icon using the following format:

"filename|#" 
where "filename" is the name of the file, followed by a vertical bar and then the offset of the desired icon in the file ("#"). The first icon in a file has an offset of 0.

For Example:

IntControl(1007, 1, 1, "", "") 
For x=0 to 10
  Click=IntControl(1007, 4, 2, "", "C:\WINDOWS\system32\shell32.dll|":x) 
  Timedelay(1)
Next
Or if you must use .ico files, then you will need to create a .ICo file for each image you would like displayed:
icons = FileItemPath ( 'C:\Program Files\WinBatch\Icons\*.ico' )
IntControl(1007, 1, 1, '', '') 
for x=1 to 10 
  ico = ItemExtract( x, icons, @tab )
  IntControl(1007, 4, 2, '', ico)
  TimeDelay(1)
next

Article ID:   W18294
Filename:   IntControl 1007 Change Icon .txt
File Created: 2008:04:14:09:31:04
Last Updated: 2008:04:14:09:31:04