Fórum winExec com arquivo.... #149615
25/03/2003
0
Olá.... eu queria saber como fazer pra rodar um arquivo com determinado programa... eu jah vi isso soh q me esqueci....
eu conheco o winexec para rodar os aplicativos, porem eu quero q rode um arquivo em determinado aplicativo....
exemplo:
rodar o arquivo C:\musica.mp3 com o windows media player
como faco???
eu conheco o winexec para rodar os aplicativos, porem eu quero q rode um arquivo em determinado aplicativo....
exemplo:
rodar o arquivo C:\musica.mp3 com o windows media player
como faco???
Anonymous
Curtir tópico
+ 0
Responder
Posts
25/03/2003
Andcarpi
Vamu ajuda ai gente......
:( :(
Plzzzzzzzzzzzz
:( :(
Plzzzzzzzzzzzz
Responder
Gostei + 0
25/03/2003
Rafaela
Esses procedimentos é para o caso de abrir um programa com determinado ´caminho´.... Tipo vc informa o caminho e ele abre...
Primeiro declare esta procedure:
procedure ExecFile(F: String);
{$R *.DFM}
{Essas são as possíveis mensagens de erro q vão surgir}
procedure TForm1.ExecFile(F: String);
var
r: String;
begin
case ShellExecute(Handle, nil, PChar(F), nil, nil, SW_SHOWNORMAL) of
ERROR_FILE_NOT_FOUND: r := ´The specified file was not found.´;
ERROR_PATH_NOT_FOUND: r := ´The specified path was not found.´;
ERROR_BAD_FORMAT: r := ´The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).´;
SE_ERR_ACCESSDENIED: r := ´Windows 95 only: The operating system denied access to the specified file.´;
SE_ERR_ASSOCINCOMPLETE: r := ´The filename association is incomplete or invalid.´;
SE_ERR_DDEBUSY: r := ´The DDE transaction could not be completed because other DDE transactions were being processed.´;
SE_ERR_DDEFAIL: r := ´The DDE transaction failed.´;
SE_ERR_DDETIMEOUT: r := ´The DDE transaction could not be completed because the request timed out.´;
SE_ERR_DLLNOTFOUND: r := ´Windows 95 only: The specified dynamic-link library was not found.´;
SE_ERR_NOASSOC: r := ´There is no application associated with the given filename extension.´;
SE_ERR_OOM: r := ´Windows 95 only: There was not enough memory to complete the operation.´;
SE_ERR_SHARE: r := ´A sharing violation occurred.´;
else
Exit;
end;
ShowMessage(r);
end;
No onclique de um botão coloque:
ExecFile(Edit1.text);
Declare em Uses ShellApi
Espero ter ajudado........
Primeiro declare esta procedure:
procedure ExecFile(F: String);
{$R *.DFM}
{Essas são as possíveis mensagens de erro q vão surgir}
procedure TForm1.ExecFile(F: String);
var
r: String;
begin
case ShellExecute(Handle, nil, PChar(F), nil, nil, SW_SHOWNORMAL) of
ERROR_FILE_NOT_FOUND: r := ´The specified file was not found.´;
ERROR_PATH_NOT_FOUND: r := ´The specified path was not found.´;
ERROR_BAD_FORMAT: r := ´The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).´;
SE_ERR_ACCESSDENIED: r := ´Windows 95 only: The operating system denied access to the specified file.´;
SE_ERR_ASSOCINCOMPLETE: r := ´The filename association is incomplete or invalid.´;
SE_ERR_DDEBUSY: r := ´The DDE transaction could not be completed because other DDE transactions were being processed.´;
SE_ERR_DDEFAIL: r := ´The DDE transaction failed.´;
SE_ERR_DDETIMEOUT: r := ´The DDE transaction could not be completed because the request timed out.´;
SE_ERR_DLLNOTFOUND: r := ´Windows 95 only: The specified dynamic-link library was not found.´;
SE_ERR_NOASSOC: r := ´There is no application associated with the given filename extension.´;
SE_ERR_OOM: r := ´Windows 95 only: There was not enough memory to complete the operation.´;
SE_ERR_SHARE: r := ´A sharing violation occurred.´;
else
Exit;
end;
ShowMessage(r);
end;
No onclique de um botão coloque:
ExecFile(Edit1.text);
Declare em Uses ShellApi
Espero ter ajudado........
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)