How to start the application from the appendix

How to start the application from the appendix

When writing other programs in a programming language C ++ it is possible to integrate function which allows to start other applications in an operating system of the personal computer.

The sponsor of placement P&G Articles on the subject "How to Start the Application from the Appendix" How to use api How to create a crossword puzzle on the computer How to establish the software on the computer


Create the proprietary application on sorting of photos. To add to it originality and functionality, you can add a call of the graphic interface directly from the program in which work. In language C ++ there are two functions for implementation of similar tasks. Connect windows.h and Shellapi.h libraries to have opportunity to use functions of start of external applications of an operating system. Connection of libraries is carried out by means of the operator #include.

Use the ShellExecute function () if you need to give parameters to the caused appendix. Function has the following parameters: hwnd for the identifier of a window, lpOperation sets operation for the caused appendix (for example, print or open), lpDirectory sets a catalog name by default, nShowCmd — the mode of an application launch and lpParameters for transfer of other parameters to the caused appendix.

For simple start of the specified program use the WinExec function (). Parameter in which the full way to the appendix, and also the mode of start of this appendix is specified is transferred to a code of the program line.

As an example it is possible to use the following fragment of a code:
void main ()
WinExec ("c:\windows\system32\calc.exe", SW_SHOW);

As a result of performance of this code the standard calculator of the Windows operating system will open. You can describe various conditions at which performance the call of external applications of an operating system is carried out. Do not forget to include necessary libraries for work with these functions.

Register standard applications which will be for certain installed at users. Consider it in case use the program not only you. If you have problems with writing of the program, see special videos of the instruction on the Internet.