How To Launch An Application From An Application

Table of contents:

How To Launch An Application From An Application
How To Launch An Application From An Application

Video: How To Launch An Application From An Application

Video: How To Launch An Application From An Application
Video: 7 Step Framework To Build And Launch Your App in 2021 2024, December
Anonim

When writing other programs in the C ++ programming language, you can integrate a function that allows other applications to run on the operating system of a personal computer.

How to launch an application from an application
How to launch an application from an application

Instructions

Step 1

Create your own photo sorting app. To add originality and functionality to it, you can add a call to the graphical interface directly from the very program in which you are working. There are two functions in the C ++ language to accomplish such tasks. Connect the windows.h and Shellapi.h libraries to be able to use the functions of launching external applications of the operating system. Libraries are connected using the #include statement.

Step 2

Use the ShellExecute () function if you need to pass parameters to the called application. The function has the following parameters: hwnd for the window identifier, lpOperation specifies the operation for the called application (for example, print or open), lpDirectory specifies the default directory name, nShowCmd for the application launch mode, and lpParameters for passing other parameters to the called application.

Step 3

To easily run the specified program, use the WinExec () function. A string parameter is passed to the program code, which specifies the full path to the application, as well as the launch mode of this application.

Step 4

The following piece of code can be used as an example:

#include

#include

void main ()

{

WinExec ("c: / windows / system32 / calc.exe", SW_SHOW);

}

Step 5

As a result of executing this code, a standard Windows calculator will open. You can describe various conditions under which external applications of the operating system are called. Remember to include the required libraries to work with these functions.

Step 6

List the standard applications that users are likely to install. Keep this in mind if the program will be used not only by you. If you have problems writing a program, watch the special video instructions on the Internet.

Recommended: