How to make my app to stay in tray icon and when any other application is active to showsUP form1
Example :
1.I start my app
2.automaticly stay only in tray (mean nothing form on the desktop, only tray)
3.waiting for any process or window (example winamp)
4.and when winamp is active then shows up form1.frm
OK. To put your application in the tray, there are lots of examples on VBF and in Google.
For The latter part, if you want to catch a perticular window i.e winamp,
you use GetForegroundWindow() to get teh handle of the active window. then use use GetWindowText() to get the caption of the window. now you check weather the caption equal to the window your searching for. i.e. winamp. if it is, yes, time to Show your form.
The GetForegroundWindow function returns a handle to the window with which the user is currently working. In this case, the user will not be working with a window that just pops up.
I think the use of FindWindow run from a timer in the sys tray app might do the trick.
My question is FindWindow requires you to know the window caption. Will you know the window caption of what you are trying to find?
I made a sample project for you with a timer.
the timer checks the forground window every 5 second.
if the forground window name is 'Calculator' the form 2 fires up.
so you can change 'Calculator' to what ever the app name you want.