dcsimg
Results 1 to 7 of 7

Thread: [RESOLVED] How to minimize another program when you have the pID

  1. #1

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    Resolved [RESOLVED] How to minimize another program when you have the pID

    I launch a command line program and it is running in a dos box. How can I minimize this dos window? When I launch the program, I grab the pID...

    pID = Shell("dosProgram.exe", vbNormalFocus)

    I can activate the window (AppActivate pID), but how can I minimize it?

    Thanks in advance for the help!
    Brian

  2. #2

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    Re: How to minimize another program when you have the pID

    Or maybe I can launch it minimized? I tried using vbHide, but I'm guessing you can't hide a dos window?

  3. #3

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    Re: How to minimize another program when you have the pID

    Ok, vbMinimizedFocus worked. Anyway I can hide this window?

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,999

    Re: How to minimize another program when you have the pID

    You would need to use the API ShellExecute function

  5. #5

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    Re: How to minimize another program when you have the pID

    Would the API ShellExecute function also return the process id, or does it return the handle? I use "AppActivate pID" before sending keystrokes to the dos window. Not sure if that would work with a handle the way it does with the process id.

  6. #6
    Hyperactive Member
    Join Date
    Mar 2014
    Posts
    321

    Re: How to minimize another program when you have the pID


  7. #7
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: [RESOLVED] How to minimize another program when you have the pID

    Quote Originally Posted by BrianPaul View Post
    I launch a command line program and it is running in a dos box. How can I minimize this dos window? When I launch the program, I grab the pID...

    pID = Shell("dosProgram.exe", vbNormalFocus)

    I can activate the window (AppActivate pID), but how can I minimize it?

    Thanks in advance for the help!
    Brian
    First you want to minimize window, then use AppActivate pID to activate window.
    Now you want to hide window, then activate it while hiding?
    And send keystrokes to activated window while activated window is hidden?

    Edit:
    By the way when using vbHide, it works, the window is hidden (not visible).
    Process is alive.
    Last edited by Max187Boucher; May 24th, 2014 at 10:09 PM.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width