Board index » delphi » WinExec and File Associations

WinExec and File Associations

I have an application with an edit box containing a filename eg.
dbnavnew.zip.  When I press a specific button I want WinZip to launch
and open the file specified in the edit box.  Essentially I want the
same response as if I double-clicked on the filename in Explorer.  How
can I do this?  I have managed, using winexec, to execute "winzip.exe -e
dbnavnew.zip" successfully...well almost (there must be command line
parameters i can pass to winzip because the preceeding statement causes
winzip to start with the extraction)

My question is this.  How do I get Delphi to recognise file
associations?

Any clues?
Please reply to newsgroup or email at lo...@elsburg1.agric.za

 

Re:WinExec and File Associations


Quote
Louis Heim wrote:
> My question is this.  How do I get Delphi to recognise file
> associations?

Use ShellExecute() - It can execute documents (data files associated
with a program).

This question has been posted zillion times before. Don't you guys
*read* the newsgroup ;-)

HTH,
Alon Yaffe
==========

Re:WinExec and File Associations


In article <3293256A....@netvision.net.il>, Alon Yaffe
<ori...@netvision.net.il> writes

Quote
>Louis Heim wrote:

>> My question is this.  How do I get Delphi to recognise file
>> associations?

>Use ShellExecute() - It can execute documents (data files associated
>with a program).

A lot of windows programs will accept a file name and path as a command
line parameter when you run them.

I have successfully included these in winexec calls and run the app
that way.

---------------------------------------------------------
Martin Doyle     email  mar...@longship.demon.co.uk
Maldon             web  http://www.longship.demon.co.uk
ESSEX              IRC  odo
England
---------------------------------------------------------

Re:WinExec and File Associations


Quote
Martin Doyle wrote:
> A lot of windows programs will accept a file name and path as a command
> line parameter when you run them.

> I have successfully included these in winexec calls and run the app
> that way.

The Win32 documentation states that WinExec() is obsolete, and therefore
*should not be used* in Windows95 / WindowsNT. It is being supported
only to provide backward compatibility. Use ShellExecute() /
ShellExecuteEx() / CreateProcess() instead.

Regards,
Alon Yaffe
==========

Other Threads