Tuesday, October 28, 2008

Small Sample code to call 'windows application' from C++Builder.

//---------------------------------------------------------------------------

#include
#include
#include


#pragma hdrstop

#include "openNotepadTest.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
char commandLine[200];


sprintf(commandLine,"notepad.exe TestReport.txt");

WinExec(commandLine, SW_SHOWNORMAL);
}
//---------------------------------------------------------------------------

No comments: