CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2009
    Posts
    3

    Launch an application with no window that will appear in the applications tab

    Hello,
    here's one for you:
    I am launching an application using CerateProcess with
    CREATE_NO_WINDOW flag.
    I don't want a window because I launch several hundreds of these
    processes.
    I do, however, want the processes to appear in the applications tab of
    the task manager so I can terminate them gracefully (end process kills
    them immediately while end task sends a signal I can catch and release
    resources).

    So far, I found that in order for an application to be on the
    applications tab it needs to be in the foreground. Is there a way to
    have an application with no window run in the foreground?

    Any other suggestion achieving the same goal of numerous processes
    launched, with little memory usage and without opening cluttering
    windows, that can be terminated with end task will be welcomed.

    Thanks

    Eran

  2. #2
    Join Date
    Aug 2008
    Posts
    23

    Re: Launch an application with no window that will appear in the applications tab

    Can't you launch the process, then send SW_HIDE to the Window Class to make it hide but still showing in the task manager?

    I was searching a part of your question, and I got this as one of the answers, skimming through it sounds like it can fix your bottle neck.

    http://www.ddj.com/windows/184405755

    ~~~Matt

  3. #3
    Join Date
    Mar 2009
    Posts
    3

    Re: Launch an application with no window that will appear in the applications tab

    Thanks Matt,
    Closing the window is my fallback but I don't really want to do this because I don't want to involve window handles and pure WinAPI objects as the code will be cross platform eventually (using ACE).

    Another option was to leave the process in the back and terminate it using end process from task manager. Do you know of a way to catch this signal? I haven't found one.

    Eran

  4. #4
    Join Date
    Feb 2009
    Location
    India
    Posts
    444

    Re: Launch an application with no window that will appear in the applications tab

    If there is no Window, how do you expect Task Manager to send you a message.
    «_Superman
    I love work. It gives me something to do between weekends.

    Microsoft MVP (Visual C++)

  5. #5
    Join Date
    Mar 2009
    Posts
    3

    Re: Launch an application with no window that will appear in the applications tab

    That's exactly the question:
    Does an application have to have a window in order to appear in the applications tab?
    It appears in the processes tab even with no window

  6. #6
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Launch an application with no window that will appear in the applications tab

    Quote Originally Posted by eranben View Post
    That's exactly the question:
    Does an application have to have a window in order to appear in the applications tab?
    Taskbar
    A quote:
    Appearing on taskbar

    The system determines if a window is displayed on taskbar as follows:
    A window has a taskbar button if:
    • The window is visible (ShowWindow was called with SW_SHOW).
    • The window doesn't have an owner or was created with the WS_EX_APPWINDOW extended style.

    A window doesn't have a taskbar button if:
    • The window is hidden (ShowWindow was called with SW_HIDE).
    • The window has an owner or was created with the WS_EX_TOOLWINDOW extended style.


    So while developers don't have direct control over the windows that have taskbar buttons, they do have indirect control through window attributes.

    Every instance of a program displayed on the desktop has a taskbar button that represents the program's primary window. A program may have secondary modal windows (such as modal dialog boxes), or modeless windows (such as modeless dialog boxes, palette windows, and undocked task panes and toolbars). Through the primary window's taskbar button, the primary window along with all its secondary windows are minimized, restored, and brought to the top level as a group. Certain modeless windows have their own taskbar buttons for direct access.
    It appears in the processes tab even with no window
    Yeah, sometimes it does. When its window is invisible.
    Best regards,
    Igor

  7. #7
    Join Date
    Nov 2007
    Posts
    613

    Re: Launch an application with no window that will appear in the applications tab

    Don't use the task manager. Define a combination of keys you use to terminate the process. From a timer, read the status of the keyboard periodically. If that combination of keys is pressed, start waiting for a process identifier to be typed. Then exit the desired process.

    You can even consider a console application managing all of your processes.

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

Featured