#include <shellapi.hpp> //used with ShellExecute
void __fastcall TForm1::Image1Click(TObject *Sender)
{
char szPro1[160];
if(GetPrivateProfileString("BUTTON_1", "1",
"", szPro1, sizeof(szPro1), NewIniFile) > 2) {
char *s1 = szPro1;
fnsplit(s1,drive,dir,file1,ext);
char szDf1[160];
sprintf(szDf1, "%s%s", drive, dir);
if(DirectoryExists(szPro1) == true) {
String S1;
S1 = ExtractShortPathName(szPro1);
ShellExecute(Form1->Handle, "open", S1.c_str(), NULL, NULL, SW_SHOWNORMAL); }
else {
ShellExecute(Form1->Handle, "open", szPro1, NULL, szDf1, SW_SHOWNORMAL); }
}
}
I hope this helps you to understand how the ShellExecute function is used.