Ver Mensaje Individual
  #1  
Antiguo 25-06-2020
Avatar de aguml
aguml aguml is offline
Miembro
 
Registrado: may 2013
Posts: 885
Reputación: 11
aguml Va por buen camino
Abrir archivo o programa con doble clic en item de TListBox

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 0LB->Items->Counti++) {
        if(
LB->Selected[i]){
            
ShellExecute(NULLL"open"LB->Items->Strings[i].c_str(), NULLNULLSW_SHOWNORMAL);
            break;
        }
    }

Responder Con Cita