Description
This example shows how to use the Win32 API function WinExec().
WinExec.cpp
Copyright © 1997-2002 Rodolfo A. Frino. All rights reserved.
#include <vcl.h>
#pragma hdrstop
#include "WinExec.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//Open StarCinema Media Player and start playing one movie
//
WinExec("C:\\Program Files\\StarCinema\\starcinema.exe C:\\_1MM\\earth.mpg",
SW_SHOWNORMAL);
//Open NotePad and open autoexec.bat file
//
WinExec("C:\\Windows\\notepad.exe C:\\autoexec.bat", SW_SHOWNORMAL);
}