La idea es que cuando haga doble clic sobre uno de los items del ListBox me ejecute el path que tiene abriendose el ejecutable o fichero o directorio. Lo tengo así y funciona pero me gustaría saber si hay algun modo mejor sin usar un bucle:
Código PHP:
void __fastcall TForm1::ListBoxCoincidenciasDblClick(TObject *Sender)
{
OpenPathSelected(ListBoxCoincidencias);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBoxSeleccionadosDblClick(TObject *Sender)
{
OpenPathSelected(ListBoxSeleccionados);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OpenPathSelected(TListBox *LB)
{
for (int i = 0; i < LB->Items->Count; i++) {
if(LB->Selected[i]){
ShellExecute(NULL, L"open", LB->Items->Strings[i].c_str(), NULL, NULL, SW_SHOWNORMAL);
break;
}
}
}