|
Prev: GDI+ hackaround
Next: ListView: how to detect if the item is selected with the first mouse click?
From: Lorin on 19 Jul 2008 19:16 VB6 I need to See if a .exe application is "registered" then Start it up with command prameters if it is not "registered" then Start it up knowing where it exists with command parameters How do I do that? e.g. pseudo-code If IsReg(Editor.exe) then StartExe Editor.exe filename argument else If FileExists(c:\Editor.exe) then StartExe c:\Editor.exe filename argument else MsgBox "Cannot find Editor" endif endif
From: MikeD on 19 Jul 2008 20:19 "Lorin" <Lorin(a)discussions.microsoft.com> wrote in message news:44000A87-249C-4F1D-9544-51AB3683467A(a)microsoft.com... > VB6 > I need to > See if a .exe application is "registered" then > Start it up with command prameters > if it is not "registered" then > Start it up knowing where it exists with command parameters > How do I do that? > > e.g. > pseudo-code > If IsReg(Editor.exe) then > StartExe Editor.exe filename argument > else > If FileExists(c:\Editor.exe) then > StartExe c:\Editor.exe filename argument > else > MsgBox "Cannot find Editor" > endif > endif > I think you'll need to explain better what you mean by "registered". Is this an ActiveX EXE? Other than ActiveX EXEs, they aren't registered in the sense of COM. Or do you simple need to know if its Path is somewhere in the Registry that you can retrieve? I'm guessing the latter. Many apps store their path here: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths But this is no guarantee as it's up to the app itself (usually its Setup) to write this information to the Registry and it's not a requirement. You're best bet, IMO, is to provide a dialog box in your app in which the user can specify this other app's location and then save that yourself somewhere. You might try looking in the above Registry key first and if you don't find it, show the dialog. -- Mike Microsoft MVP Visual Basic
From: Lorin on 20 Jul 2008 13:46 I am trying the following. vRet=Shell(application.exe) ' the system knows this application and can find it without specifying the full path If this fails then I try vRet=Shell(drive:\path\application.exe) ' I specify the whole path I expect the application is there and installed. If it is not, then it may have simply been copied to some folder. I could scan all folders and if found then fully specify. Is this the best way to do this or am I totally missing something "Lorin" <Lorin(a)discussions.microsoft.com> wrote in message news:44000A87-249C-4F1D-9544-51AB3683467A(a)microsoft.com... > VB6 > I need to > See if a .exe application is "registered" then > Start it up with command prameters > if it is not "registered" then > Start it up knowing where it exists with command parameters > How do I do that? > > e.g. > pseudo-code > If IsReg(Editor.exe) then > StartExe Editor.exe filename argument > else > If FileExists(c:\Editor.exe) then > StartExe c:\Editor.exe filename argument > else > MsgBox "Cannot find Editor" > endif > endif >
From: Woodie M on 20 Jul 2008 22:29 Have you tried the Shellexecute API? It will laujch the document with whatever application is associated with it, just as if the user double-clicked the document. 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 Public Const SW_SHOWMAXIMIZED = 3 Public Const SW_SHOWWINDOWED = 1 Public Const SW_SHOWNORMAL = 1 RetVal = ShellExecute(MyForm.hwnd, "Open", Filename, "", Path, SW_SHOWNORMAL) -Woodie "Lorin" <Lorin(a)discussions.microsoft.com> wrote in message news:44000A87-249C-4F1D-9544-51AB3683467A(a)microsoft.com... > VB6 > I need to > See if a .exe application is "registered" then > Start it up with command prameters > if it is not "registered" then > Start it up knowing where it exists with command parameters > How do I do that? > > e.g. > pseudo-code > If IsReg(Editor.exe) then > StartExe Editor.exe filename argument > else > If FileExists(c:\Editor.exe) then > StartExe c:\Editor.exe filename argument > else > MsgBox "Cannot find Editor" > endif > endif >
From: Lorin on 21 Jul 2008 17:29 Yes I use that but that is not what i want to do here. Bottom line, I want to start any application with command line parameters. In the first instance, i do not want to have to specify the full path and if that fails, i can try specifying a full path. "Woodie M" wrote: > Have you tried the Shellexecute API? It will laujch the document with > whatever application is associated with it, just as if the user > double-clicked the document. > > 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 > Public Const SW_SHOWMAXIMIZED = 3 > Public Const SW_SHOWWINDOWED = 1 > Public Const SW_SHOWNORMAL = 1 > > > RetVal = ShellExecute(MyForm.hwnd, "Open", Filename, "", Path, > SW_SHOWNORMAL) > > -Woodie > > "Lorin" <Lorin(a)discussions.microsoft.com> wrote in message > news:44000A87-249C-4F1D-9544-51AB3683467A(a)microsoft.com... > > VB6 > > I need to > > See if a .exe application is "registered" then > > Start it up with command prameters > > if it is not "registered" then > > Start it up knowing where it exists with command parameters > > How do I do that? > > > > e.g. > > pseudo-code > > If IsReg(Editor.exe) then > > StartExe Editor.exe filename argument > > else > > If FileExists(c:\Editor.exe) then > > StartExe c:\Editor.exe filename argument > > else > > MsgBox "Cannot find Editor" > > endif > > endif > > > >
|
Pages: 1 Prev: GDI+ hackaround Next: ListView: how to detect if the item is selected with the first mouse click? |