Re: Running other applications
From: Björn Holmgren (bjohol_at_hotmail.com)
Date: 09/24/04
- Next message: Björn Holmgren: "Re: Add controls to tab strip"
- Previous message: J French: "Re: Poor VB Programming"
- In reply to: JaleDones: "Re: Running other applications"
- Next in thread: JaleDones: "Re: Running other applications"
- Reply: JaleDones: "Re: Running other applications"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Sep 2004 10:22:05 +0200
In order to use the FindExecutable function, the application must be
associated with a file type (extension). You have to create a dummy file
with that extension and call FindExecutable passing the path and name of
that file.
Here's an example that locates the default browser by creating a dummy .HTM
file and calling FindExecutable:
'----------
Private Declare Function FindExecutable Lib "shell32.dll" Alias _
"FindExecutableA" (ByVal lpFile As String, _
ByVal lpDirectory As String, ByVal lpResult As String) As Long
Private Function DefaultBrowser() As String
Dim strBrowser As String
Dim strHTMFile As String
Dim lFileNo As Long
strHTMFile = Environ("TEMP") & "\temp.htm"
lFileNo = FreeFile
Open strHTMFile For Output As #lFileNo
Print #lFileNo, "Test for default browser..."
Close #lFileNo
strBrowser = Space(255)
FindExecutable strHTMFile, "", ByVal strBrowser
Kill strHTMFile
strBrowser = Replace(strBrowser, Chr(0), " ")
strBrowser = Left(strBrowser, InStr(1, strBrowser, ".exe") + 3)
DefaultBrowser = strBrowser
End Function
'----------
-- Björn Holmgren "JaleDones" <djones_1> wrote in message news:O93W5scoEHA.3464@tk2msftngp13.phx.gbl... > Hi Mike, > > The app is a program called Data Junction. Its an older version and it > appears to have some functionality with automation but other than messing > around with Word, I have very little experience with automating > applications. > > I could not get the syntax correct with Data Junction. I believe the errors > were something like -- ActiveX can't create object. > > While I have even less experience with calling API functions, your 3rd > option of "FindExecutable" sounds enticing. The name implies what I am > looking for. > > Regards > Dale Jones > > > "MikeD" <nobody@nowhere.edu> wrote in message > news:enJFKkcoEHA.2588@TK2MSFTNGP12.phx.gbl... > > > > "Dale" <daljones@accudirect.com> wrote in message > > news:e3VUOyboEHA.1988@TK2MSFTNGP09.phx.gbl... > > > All, > > > > > > I have an application I am shelling to from a certain click event. > > > > > > It works fine on my machine but bombs on somone elses because their > > > installation is in another location. > > > > > > I know app.path would give the location of my running program but I need > > > something that will tell me (?search the registry) where a certain > program > > > is located on someone elses machine. > > > > > > I guess I'm trying to ask "How do I find the appplication I want to > shell > > > to - independent of where it is installed. > > > > > > I'm currently still searching my resources for an answer. > > > > > > > > > What's the application you're wanting to run. There are numerous ways to > run > > the app. For example, if it supports Automation, you can instantiate an > > instance of it. If a certain file extension is associated with it, you can > > open the file in that app by calling the ShellExecute API function, or get > > the path and filename of the associated app by calling the FindExecutable > > API function. There are other ways as well. In order for us to tell what > may > > best suit your needs, you need to tell us what the app is. > > > > Mike > > > > > >
- Next message: Björn Holmgren: "Re: Add controls to tab strip"
- Previous message: J French: "Re: Poor VB Programming"
- In reply to: JaleDones: "Re: Running other applications"
- Next in thread: JaleDones: "Re: Running other applications"
- Reply: JaleDones: "Re: Running other applications"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|