Window wait active and tray icon BIG Help !
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
please gimme example source code ..
thanks !
Re: Window wait active and tray icon BIG Help !
Re: Window wait active and tray icon BIG Help !
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.
:D
Re: Window wait active and tray icon BIG Help !
subclass HCBT_CREATEWND (or anything else what is fired when window is created/shown)
Re: Window wait active and tray icon BIG Help !
can u gimme a little example (without tray icon. if with tray will be GREAT !! )
Re: Window wait active and tray icon BIG Help !
please help me :) im newbie :S
Re: Window wait active and tray icon BIG Help !
You requir something like thease (Not Exactly) :)
http://www.vbforums.com/showthread.php?t=482802
Re: Window wait active and tray icon BIG Help !
can u gimme a fixed example :S
i think i something possible like this :
if GetForegroundWindow() then
form1.show
end if
but dont know what to code correctly
Re: Window wait active and tray icon BIG Help !
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?
1 Attachment(s)
Re: Window wait active and tray icon BIG Help !
GoA_Trance
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.
Check the attachment