By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,142 Members | 1,831 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,142 IT Pros & Developers. It's quick & easy.

Place Any Application in the System Tray

P: n/a
Hello To All You Real Programmers Out There!!

There is an application called: "Tray It"

Webpage:
----------

http://www.teamcti.com/trayit/trayit.htm

Direct Download:
------------------

http://www.teamcti.com/trayit/trayit.zip

What I want to do is mimic adding any application to the system tray/keeping
that particular applications icon in the tray, like Tray It does.

I have e-mailed the webmaster to ask them if they will give me any pointers,
but they haven't replied as yet.

Do you have any ideas (real code) that will help me achieve the above? [No
Google Group links thanks Herfried :)]

Thanks in advance,

Crouchie1998

BA (HONS) MCP MCSE
Nov 21 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
in the designer, drag a notify icon item onto your form, then assign an icon
to it in the deisgn property. then in the code window, where you want to hide
the window, do the code

""Air Code""

me.notifyicon.visible = true
me.hide()

""End Air Code""

then to show the form again, in the code window, do a notify icon double
click event and do this

""Air Code""

me.notifyicon.visible = false
me.show()

"End Air Code""

if that doesnt help, ask me and i can send u some real code on how to do it,
hope this helps
Nov 21 '05 #2

P: n/a
Did you read what I wrote?
LOL @ Your Reply!!

I can put my own application in the sytem tray, but if you downloaded that
application I mentioned then you will see what I am trying to do. I only
know of two people that have actually done this so far. Both of them have
coded it in C++ & although keyboard hooking is simple, I cannot work out how
the Tray It is coded

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #3

P: n/a
Crouchie1998 wrote:
know of two people that have actually done this so far. Both of them have
coded it in C++ & although keyboard hooking is simple, I cannot work out how
the Tray It is coded


I don't know how Tray It works, but couldn't you use FindWindow to get
the window handle of the window you want, then send it a message to
minimize and then place an icon in the tray?

Nov 21 '05 #4

P: n/a
Hello,

AFAIK you'll have to implement a global hook for this.

"Global System Hooks in .NET":
http://www.codeproject.com/csharp/GlobalSystemHook.asp

You can catch WM_SYSCOMMAND message sent to any window and if its wParam
equals SC_MINIMIZE:

1. Loop through all windows in a system and check whether they belong to
process of window being minimized (EnumWindows,
GetWindowThreadProcessId).
2. Remember which windows of this process are visible and hide them all
(IsWindowVisible, ShowWindow).
3. Create a NotifyIcon.
4. When user requests to show the app again, make all windows that were
visible visible again and hide NotifyIcon.

Just an idea,
Roman

Nov 21 '05 #5

P: n/a
I have written my own hooking class in VB6 & in VB.NET & that's somewhere on
the Internet for download, but that's not it

One of the examples I have seen assa a menu item to the system menu of ALL
open windows automatically & then you use that to minimize to tray, but the
'Tray It' application does it in a completely different way by using CTRL &
Minimize to add the window to the tray & then you are able to allow to keep
an icon in the system tray, attached to that progeam.

All I want is to add two context menu items to my existing program to allow
Otllok Express to sit in the tray automatically when minimized & my Internet
account (AOL) is in the way constantly in the Taskbar & I never use it, only
for the free connection & I want that out of the way too.

But if I have the oppotunity to add other programs automatically to the
system tray, I would.

I really need some real help with this & some positive replies to my post

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #6

P: n/a
To add context menu items to an existing program's system menu, you'll
have to play with GetSystemMenu and AppendMenu API functions. However,
to capture clicks on this items you'll still have to set up a hook to
catch WM_SYSCOMMAND etc etc.
Nov 21 '05 #7

P: n/a
Yeah I know that much already.

I have to hook all open windows & new windows being opened, then add the
item to the system menu (don't have to do this part though) & then hook into
everything. The part that I cannot do is to add a NotifyIcon to that
application with the programs own icon & handle a context menu/click events
when the application is minimized to system tray

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #8

P: n/a
try XNeat @ http://www.xneat.com/ seems to do the same thing as Trayit

Nov 21 '05 #9

P: n/a
But there is no source code with it & that's what I want

Thanks anyway for the suggestion

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #10

P: n/a
Just installed it on Windows 2000 Pro & it cannot find a certain DLL file &
won't run

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.