Hard: System Tray

Dracarys
05-15-2003, 08:11 AM
I guess I've got some pretty hard questions today. ;)

I want to make a System Tray like Windows has. As i don't run explorer.exe I have the need for a system tray. Quite a lot of programs (Winamp, my Antivir and my firewall and of course the windows icon [sound, network,...]) put their icons into the tray. I can't just ignore this.

So, what i want to do is a program that emulates the *complete* behaviour of the windows system tray. :) Any ideas?

jonnebonne
05-15-2003, 08:29 AM
Just search the forum ... I know that it is a lot of posts about systray ... :)

Dracarys
05-15-2003, 08:35 AM
Just search the forum ... I know that it is a lot of posts about systray ... :)

I did. But it's all about making Systray icons...

jonnebonne
05-15-2003, 08:42 AM
Ok, I see :p

Click here then (http://www.mentalis.org/tips/tip61.shtml)

Hope that this will help you :)

Dracarys
05-15-2003, 08:46 AM
Ok, I see :p

Click here then (http://www.mentalis.org/tips/tip61.shtml)

Hope that this will help you :)

No, buddy. :D Thanks, but read my first post. I don't want to put an icon into the systray, I want to *make a systray* where other apps put their icons in. Means: I want a copy of the windows system tray. ;)

jonnebonne
05-15-2003, 08:48 AM
OK :D I see I don't really know the answer of your question... sry

Dracarys
05-15-2003, 09:14 AM
OK :D I see I don't really know the answer of your question... sry


It's ok, as long as ANYBODY knows what to do.... :(

Daraja
05-15-2003, 11:07 AM
Err... maybe (I'm not sure), but maybe the statusbar could come in handy...

You can find in in the Microsoft Windows Common Controls 6.0 component.

Hope it helps... ;)

mmx2
05-15-2003, 12:52 PM
if you dont use explorer.exe.. then what shell do you use?...

nasbité
05-15-2003, 02:53 PM
I guess I've got some pretty hard questions today. ;)

I want to make a System Tray like Windows has. As i don't run explorer.exe I have the need for a system tray. Quite a lot of programs (Winamp, my Antivir and my firewall and of course the windows icon [sound, network,...]) put their icons into the tray. I can't just ignore this.

So, what i want to do is a program that emulates the *complete* behaviour of the windows system tray. :) Any ideas?

1. Have you Googled this issue?

2. The obvious answer to your question is: use Explorer.exe.

3. In terms of recreating the systray, you'll need to use a slew of MS Common Controls (as Daraja stated), and effectively have your explorer.exe-alternative capture all messages to know what to do (e.g. extract icons).

4. Simply decompile Explorer.exe, and see what the heck it does! :whoops:

Gamer X
05-15-2003, 07:53 PM
This Code Library submission by Squirm (http://www.visualbasicforum.com/showthread.php?threadid=78075) shows how to make a bar that will push back the desktop as the taskbar does.

After that, APIs to find which windows are up would be good, plus a nice utilization of Time$ . . .

Hey, it's a start.

Arigato,
Gamer X

Dracarys
05-16-2003, 01:42 AM
Err... maybe (I'm not sure), but maybe the statusbar could come in handy...

You can find in in the Microsoft Windows Common Controls 6.0 component.

Hope it helps... ;)


I dont think this one would help much. :D I'm trying to make t without any OCXs or DLLs at all. I even rip out the dependencies of the MSVBVM60.dll. ;) Read my comment below to know, why. But thanks all the same. :)

Dracarys
05-16-2003, 01:43 AM
if you dont use explorer.exe.. then what shell do you use?...

Errrr... I made my own shell. That is, to say, I messed around with windows and replaced more than 100 DLLs so far. Read below, to know why.

Dracarys
05-16-2003, 01:46 AM
1. Have you Googled this issue?

2. The obvious answer to your question is: use Explorer.exe.

3. In terms of recreating the systray, you'll need to use a slew of MS Common Controls (as Daraja stated), and effectively have your explorer.exe-alternative capture all messages to know what to do (e.g. extract icons).

4. Simply decompile Explorer.exe, and see what the heck it does! :whoops:[/QUOTEPOST]


1) Of course. ;)

3) I don't need Common Controls. You can rebuiuld all the functions of the common controls. My explorer.exe alternative captures all the messages. But I don't know what to do with them. :(

4) (and 1) I did that. That was the reason why I decided to build my own. The explorer.exe code sucks! (At least the one that comes with XP SP1) I replaced it effectively with my own. Taskbar, Desktop, Login, Autorun, all those things work. Only the traybar is in developement. ;)

Dracarys
05-16-2003, 01:48 AM
This Code Library submission by Squirm (http://www.visualbasicforum.com/showthread.php?threadid=78075) shows how to make a bar that will push back the desktop as the taskbar does.

After that, APIs to find which windows are up would be good, plus a nice utilization of Time$ . . .

Hey, it's a start.

Arigato,
Gamer X


Indeed it is. :) I did that already. The taskbar was no problem. It works even better than the windows taskbar. In fact, my shell is better than Litestep. (Of course, it doesn't have the functionality of Litestep. Nor the skins. But it does EVERYTHING I want it to do. :D It's pretty customized for my own needs.) Thanks for the note. ;)

Garmour
05-16-2003, 02:05 AM
Why not just use a picture box or image control. It will allow all of the functionality of a systray, namely mouse_move, mouse_click, mouse_doubleclick. It can hold pictures (program icons).
You already recieve all of the windows messages so I'm sure it shouldn't be a problem for you to create a custom picutrebox that emulates a systray. Well within your abilities if you've already produced an explorer clone in VB (and replaced ~100 dll files).

Would it be possible for you to show a screen shot of your desktop ? I'd be interested in seeing it.

Dracarys
05-16-2003, 02:22 AM
Why not just use a picture box or image control. It will allow all of the functionality of a systray, namely mouse_move, mouse_click, mouse_doubleclick. It can hold pictures (program icons).
You already recieve all of the windows messages so I'm sure it shouldn't be a problem for you to create a custom picutrebox that emulates a systray. Well within your abilities if you've already produced an explorer clone in VB (and replaced ~100 dll files).

Would it be possible for you to show a screen shot of your desktop ? I'd be interested in seeing it.

True. I can't use controls, though. As i said, i ripped even the msvbvm60.dll dependencies out of the exe. That means: Only APIs. NO controls. ;) But i know what you mean. That isn't my problem. I hook the tray and receive the messages. I only don't know what to do with them. :D

BTW: Replacing the DLLs wasn't my work, of course. There are many great Open Source people on the net who write dll replacements for windows. I just tweaked the code of some of them to fit my purposes (the latest was msgina.dll, which does the logon and logoff. So now I have shutdown scripts like linux has, hehe. Get it here: http://wwwthep.physik.uni-mainz.de/~frink/nt.html)

The explorer clone in VB was the biggest problem. My C or C++ knowledge isn't that great, unfortunately. :(

Well, it isn't ready yet but I've gotten quite far. The attached screenshot isn't reality yet but the single parts (like the clock or the taskmanager) are working. The systray in the lower right corner works only half. :( The code is taken from PSC. It catches the NOTIFYICONDATA structures and the NIM_ADD, NIM_MODIFY, ... messages. But it sucks. Animated icons appear as 10 icons, tooltips don't work... Bah!

Oh yes, the design is taken from Litestep. :D I like Litestep but it can't do what I need. :( Unfortunately.

In the next post i will include my current systray code. (Not the one you see in the picture)

Dracarys
05-16-2003, 02:29 AM
bWnd = FindWindowEx(FindWindow("Shell_TrayWnd", vbNullString), ByVal 0&, "TrayNotifyWnd", vbNullString)
iWnd = FindWindowEx(bWnd, ByVal 0&, "SysPager", vbNullString)
tWnd = FindWindowEx(iWnd, ByVal 0&, "ToolbarWindow32", vbNullString)

' Now to get the number of buttons:
' Something = SendMessage(tWnd, TB_BUTTONCOUNT, 0, 0)

Dim lImglstHWND As Long
Dim lTooltipHWND As Long
Dim i As Long


' These are my handles....
lImglstHWND = SendMessage(tWnd, 1073, 0, 0) 'TB_GETIMAGELIST
lTooltipHWND = SendMessage(tWnd, 1059, 0, 0) 'TB_GETTOOLTIPS


For i = 0 To SendMessage(tWnd, TB_BUTTONCOUNT, 0, 0) - 1
msgbox "Button " & cstr(i) & " image Index " & SendMessage(tWnd, 1068, i, 0)

' Now, to blit the buttons i use this:
ImageList_Draw lImglstHWND, i, Me.hDC, (10 + (i * 20)), 10, ILD_TRANSPARENT
Next


But this doesn't work. It just doesn't blit anything. I can't get the image out of the lImglstHWND! Why?

Dracarys
05-16-2003, 03:29 AM
Now don't tell me, it's too hard for you. :D :p

Dracarys
05-16-2003, 07:07 AM
Oh yes, I found a similar code:

http://www.freevbcode.com/ShowCode.Asp?ID=3291

Now I'll go and have a look how to blit the icons. Any ideas?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum