Home All Groups Group Topic Archive Search About

How to lauch associated app to file extension & view file

Author
3 Mar 2007 11:58 PM
MAB
I need to emulate double clicking on a file from Windows Explorer (launch
associated app & load file in to app) without having to know the path/file
name of the app.  If this is possible, how?

I was able to do it with Shell but I need know the path/file name of the
app.  The associated app can be different on each workstation let alone
differnt version of the app (different folder and/or file name).  The Shell
way could work if there is a way to obtain for the OS the path/file name of
the app associated to the file extension.

Author
4 Mar 2007 1:17 AM
Woodie M
You want the ShellExecute API:

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"
(ByVal _
hwnd As Long, ByVal LpOperation As String, ByVal lpFile As String, ByVal
lpParameters _
As String, ByVal lpDirectory As String, ByVal nShowcmd As Long) As Long

Dim Result as Long
Result = ShellExecute(0, "Open", "http:\\www.worship-him.com", "", APP.Path,
SW_SHOWMAXIMIZED)

-Woodie


Show quoteHide quote
"MAB" <M**@discussions.microsoft.com> wrote in message
news:12288042-701C-493A-96E8-6139C684EF30@microsoft.com...
>I need to emulate double clicking on a file from Windows Explorer (launch
> associated app & load file in to app) without having to know the path/file
> name of the app.  If this is possible, how?
>
> I was able to do it with Shell but I need know the path/file name of the
> app.  The associated app can be different on each workstation let alone
> differnt version of the app (different folder and/or file name).  The
> Shell
> way could work if there is a way to obtain for the OS the path/file name
> of
> the app associated to the file extension.
Author
4 Mar 2007 3:16 AM
MAB
Works like a champ!  Thank you Woodie.

Show quoteHide quote
"Woodie M" wrote:

> You want the ShellExecute API:
>
> Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"
> (ByVal _
> hwnd As Long, ByVal LpOperation As String, ByVal lpFile As String, ByVal
> lpParameters _
> As String, ByVal lpDirectory As String, ByVal nShowcmd As Long) As Long
>
> Dim Result as Long
> Result = ShellExecute(0, "Open", "http:\\www.worship-him.com", "", APP.Path,
> SW_SHOWMAXIMIZED)
>
> -Woodie
>
>
> "MAB" <M**@discussions.microsoft.com> wrote in message
> news:12288042-701C-493A-96E8-6139C684EF30@microsoft.com...
> >I need to emulate double clicking on a file from Windows Explorer (launch
> > associated app & load file in to app) without having to know the path/file
> > name of the app.  If this is possible, how?
> >
> > I was able to do it with Shell but I need know the path/file name of the
> > app.  The associated app can be different on each workstation let alone
> > differnt version of the app (different folder and/or file name).  The
> > Shell
> > way could work if there is a way to obtain for the OS the path/file name
> > of
> > the app associated to the file extension.
>
>