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

Instruction

1
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.

2
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.

3
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.

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

5
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.

6
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.