Place Any Application in the System Tray

C

Crouchie1998

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
 
G

Guest

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
 
C

Crouchie1998

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
 
C

Chris Dunaway

Crouchie1998 said:
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?
 
D

Dragon

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
 
C

Crouchie1998

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
 
D

Dragon

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.
 
C

Crouchie1998

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
 
C

Crouchie1998

But there is no source code with it & that's what I want

Thanks anyway for the suggestion

Crouchie1998
BA (HONS) MCP MCSE
 
C

Crouchie1998

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

Crouchie1998
BA (HONS) MCP MCSE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top