Results 1 to 10 of 10

Thread: Window wait active and tray icon BIG Help !

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    57

    Exclamation 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 !

  2. #2

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    57

    Re: Window wait active and tray icon BIG Help !

    any help please ?

  3. #3
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    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.


  4. #4
    Addicted Member
    Join Date
    Mar 2002
    Location
    Lithuania
    Posts
    165

    Re: Window wait active and tray icon BIG Help !

    subclass HCBT_CREATEWND (or anything else what is fired when window is created/shown)
    Last edited by GameBit; Aug 3rd, 2007 at 06:05 AM.
    P.S. Sorry for my poor English...

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    57

    Re: Window wait active and tray icon BIG Help !

    can u gimme a little example (without tray icon. if with tray will be GREAT !! )

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    57

    Re: Window wait active and tray icon BIG Help !

    please help me im newbie :S

  7. #7
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Window wait active and tray icon BIG Help !

    You requir something like thease (Not Exactly)
    http://www.vbforums.com/showthread.php?t=482802

  8. #8

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    57

    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

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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?

  10. #10
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    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
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width