Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   C++ Builder (https://www.clubdelphi.com/foros/forumdisplay.php?f=13)
-   -   Abrir fichero txt con c++builder y siempre EAccessViolation (https://www.clubdelphi.com/foros/showthread.php?t=91239)

joeyjr 09-12-2016 11:50:02

Abrir fichero txt con c++builder y siempre EAccessViolation
 
Intento abrir un txt :
Código:

AnsiString aa="d:\\info.txt";
ShellExecute(this->Handle,PChar('open'), PChar(aa.c_str()),NULL, NULL,SW_SHOWNORMAL);

y siempre el mismo error KERNELBASE.DLL EAccessViolation.

¿Algun consejo?

Gracias.

SOLUICONADO, GRACIA.S

joeyjr 09-12-2016 11:57:22

Código:

ShellExecute(this->Handle,"open", "d:\info.txt",NULL, NULL,SW_SHOWNORMAL);
si hago esto no hace absolutamente nada, tampoco da error.

Casimiro Notevi 09-12-2016 12:02:55

Recuerda poner los tags al código fuente, ejemplo:



Gracias :)

juanelo 09-12-2016 19:59:15

ShellExecute(Application->Handle, "open", File.c_str(), NULL, NULL, SW_SHOWNORMAL);

ecfisa 09-12-2016 20:14:10

Hola.

Llego tarde para avisarte de la doble barra ("\\"), pero te comento que no necesitas usar la función PChar, podes escribirlo de este modo:
Código PHP:

{
  
AnsiString aa "d:\\info.txt";

  if ((int) 
ShellExecute(Handle"open"aa.c_str(), NULLNULLSW_SHOW) < 32)
    
ShowMessageSysErrorMessageGetLastError() ) );


Saludos :)

Edito: Y también tarde para .c_str(), como recién te ha sugerido juanelo :o, (pero revisa como verifico el resultado de la operación).


La franja horaria es GMT +2. Ahora son las 06:38:46.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi