• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

Createproces - start program minimized

How do I start a command line program from the Createprocess API in a minimized state?
1 Solution
Runs an executable program and returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero.



The Shell function syntax has these named arguments:

Part      Description
pathname      Required; Variant (String). Name of the program to execute and any required arguments or command-line switches; may include directory or folder and drive.
windowstyle      Optional. Variant (Integer) corresponding to the style of the window in which the program is to be run. If windowstyle is omitted, the program is started minimized with focus.
The windowstyle named argument has these values:

Constant      Value      Description
vbHide      0      Window is hidden and focus is passed to the hidden window.
vbNormalFocus      1      Window has focus and is restored to its original size and position.
vbMinimizedFocus      2      Window is displayed as an icon with focus.
vbMaximizedFocus      3      Window is maximized with focus.
vbNormalNoFocus      4      Window is restored to its most recent size and position. The currently active window remains active.
vbMinimizedNoFocus      6      Window is displayed as an icon. The currently active window remains active.

If the Shell function successfully executes the named file, it returns the task ID of the started program. The task ID is a unique number that identifies the running program. If the Shell function can't start the named program, an error occurs.

Note   The Shell function runs other programs asynchronously. This means that a program started with Shell might not finish executing before the statements following the Shell function are executed.
ronandersenAuthor Commented:

I am using the createprocess API to execute the program, so I did not use the shell to spwn the process. I figured out the answer. One of the members in the CB strucure needs to be set to hide.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now