App Paths 
Author Message
 App Paths

Some help would be appreciated.

As most of you would know, when running an app, you either have to specify
its full path, or (if the directory containing the EXE is in the path) just
the EXE name.

What some of you may not know is that NT (and maybe 95?) allows you to
specify some apps to be run by just running the EXE name, even if the
directory containing the EXE is not in the path. It achieves this by
putting entries in the Registry under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths.

On NT (I don't have access to 95), this allows to to type in 'Winword'
(under Start -> Run) and it automatically launches Word. It manages to do
this because the registry entry mentioned above contains the full path to
the Word EXE.

Anyway, my problem is this:

The technique used above only works when launching apps from File Manager
or Start -> Run. It DOES NOT work when you try and use it from a command
prompt (cmd) or using VB's shell command. So, shell("Winword") would not
work (which is essentially what I want).

So my question is:

1) Does anyone know to (using VB) launch an app in a fashion similar to
Explorer and File Manager (ie. taking notice of entries in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths).

PLEASE NOTE THAT I AM USING WORD AS AN EXAMPLE, AND I DO NOT WANT TO KNOW
HOW TO OPEN WORD PROGRAMATICALLY. THE ACTUAL EXE IS A DIFFERENT EXE WHICH
DOES NOT SUPPORT AUTOMATION.

Please post and email all suggestions

Thanks
Matthew



Sat, 14 Oct 2000 03:00:00 GMT  
 App Paths

Matthew-
        If you know the EXE name, read the path
from the registry and shell that. There are a couple
of Knowledge Base articles on how to read and
write the registry.
        The Knowledge Base-
http://support.microsoft.com/support/c.asp

        BTW- those registry keys exist on Win95
also.
Joe
--
***********************************************************

Microsoft Developer MVP- Visual Basic
Check out Yankee Clipper Plus (April 1998
PCWorld magazine "Best Free Stuff Online")
www.tiac.net/users/lvasseur/ycphome.html
"He preaches well that lives well, quoth Sancho; that's
all the divinity I understand." Miguel de Cervantes
**********************************************************
PS- Please reply to the newsgroup- except in the
case of flames, insults, etc. (Don't bother.)



Quote:
> Some help would be appreciated.

> As most of you would know, when running an app, you either have to
specify
> its full path, or (if the directory containing the EXE is in the path)
just
> the EXE name.

> What some of you may not know is that NT (and maybe 95?) allows you to
> specify some apps to be run by just running the EXE name, even if the
> directory containing the EXE is not in the path. It achieves this by
> putting entries in the Registry under
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths.

> On NT (I don't have access to 95), this allows to to type in 'Winword'
> (under Start -> Run) and it automatically launches Word. It manages to do
> this because the registry entry mentioned above contains the full path to
> the Word EXE.

> Anyway, my problem is this:

> The technique used above only works when launching apps from File Manager
> or Start -> Run. It DOES NOT work when you try and use it from a command
> prompt (cmd) or using VB's shell command. So, shell("Winword") would not
> work (which is essentially what I want).

> So my question is:

> 1) Does anyone know to (using VB) launch an app in a fashion similar to
> Explorer and File Manager (ie. taking notice of entries in
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths).

> PLEASE NOTE THAT I AM USING WORD AS AN EXAMPLE, AND I DO NOT WANT TO KNOW
> HOW TO OPEN WORD PROGRAMATICALLY. THE ACTUAL EXE IS A DIFFERENT EXE WHICH
> DOES NOT SUPPORT AUTOMATION.

> Please post and email all suggestions

> Thanks
> Matthew



Sun, 15 Oct 2000 03:00:00 GMT  
 App Paths

I can't say I am sure, but I believe that if you use the ShellExectute API
function, it will do the trick.

Niels.

Quote:

>Some help would be appreciated.

>As most of you would know, when running an app, you either have to specify
>its full path, or (if the directory containing the EXE is in the path) just
>the EXE name.

>What some of you may not know is that NT (and maybe 95?) allows you to
>specify some apps to be run by just running the EXE name, even if the
>directory containing the EXE is not in the path. It achieves this by
>putting entries in the Registry under
>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths.

>On NT (I don't have access to 95), this allows to to type in 'Winword'
>(under Start -> Run) and it automatically launches Word. It manages to do
>this because the registry entry mentioned above contains the full path to
>the Word EXE.

>Anyway, my problem is this:

>The technique used above only works when launching apps from File Manager
>or Start -> Run. It DOES NOT work when you try and use it from a command
>prompt (cmd) or using VB's shell command. So, shell("Winword") would not
>work (which is essentially what I want).

>So my question is:

>1) Does anyone know to (using VB) launch an app in a fashion similar to
>Explorer and File Manager (ie. taking notice of entries in
>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths).

>PLEASE NOTE THAT I AM USING WORD AS AN EXAMPLE, AND I DO NOT WANT TO KNOW
>HOW TO OPEN WORD PROGRAMATICALLY. THE ACTUAL EXE IS A DIFFERENT EXE WHICH
>DOES NOT SUPPORT AUTOMATION.

>Please post and email all suggestions

>Thanks
>Matthew



Sun, 15 Oct 2000 03:00:00 GMT  
 App Paths

Joe,

Thanks for the tip. Not quite what I am looking for though.

I am trying to do it without accessing the registry if possible (ie. leave
Windows to worry about it).

Matthew



Quote:
> Matthew-
>    If you know the EXE name, read the path
> from the registry and shell that. There are a couple
> of Knowledge Base articles on how to read and
> write the registry.
>    The Knowledge Base-
> http://support.microsoft.com/support/c.asp

>    BTW- those registry keys exist on Win95
> also.
> Joe



Sun, 15 Oct 2000 03:00:00 GMT  
 App Paths

Interesting poser, I checked the Win95 OSR2.1 Registry and sure enough there
were application EXE file entries. For example i have an entry for
DirectCD.EXE and if i read the registry key i can run the program from
Start->Run just by typing the EXE name, i have tried the following program
example i created a registry key when my program was installed and from then
on it could be run from the Start->Run menu.

In answer to the question you will have to read in the registry key that
haves the EXE file as its key name under ;
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
and then read in the path to and then add it to the shell statement etc...

As for the ShellExecute API call it allows you to act upon different events
that programs are related to : for example ShellExecute
"Open","http://www.microsoft.com" would load the default web browser and
then navigate to microsoft.com, (Note the ShellExecute code will not work,
its missing a few extra param's).

Hope this helps,

Phil.



Thu, 19 Oct 2000 03:00:00 GMT  
 App Paths

Private 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

Private Sub Command1_Click()
    ShellExecute Me.hwnd, "open", "winword", "", "", 3
End Sub

where the 3 is use:

0 for hidden
1 for normal
2 for minimized
3 for maximized

lemme know how it works for ya.

Quote:

>Some help would be appreciated.

>As most of you would know, when running an app, you either have to specify
>its full path, or (if the directory containing the EXE is in the path) just
>the EXE name.

>What some of you may not know is that NT (and maybe 95?) allows you to
>specify some apps to be run by just running the EXE name, even if the
>directory containing the EXE is not in the path. It achieves this by
>putting entries in the Registry under
>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths.

>On NT (I don't have access to 95), this allows to to type in 'Winword'
>(under Start -> Run) and it automatically launches Word. It manages to do
>this because the registry entry mentioned above contains the full path to
>the Word EXE.

>Anyway, my problem is this:

>The technique used above only works when launching apps from File Manager
>or Start -> Run. It DOES NOT work when you try and use it from a command
>prompt (cmd) or using VB's shell command. So, shell("Winword") would not
>work (which is essentially what I want).

>So my question is:

>1) Does anyone know to (using VB) launch an app in a fashion similar to
>Explorer and File Manager (ie. taking notice of entries in
>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths).

>PLEASE NOTE THAT I AM USING WORD AS AN EXAMPLE, AND I DO NOT WANT TO KNOW
>HOW TO OPEN WORD PROGRAMATICALLY. THE ACTUAL EXE IS A DIFFERENT EXE WHICH
>DOES NOT SUPPORT AUTOMATION.

>Please post and email all suggestions

>Thanks
>Matthew



Fri, 20 Oct 2000 03:00:00 GMT  
 App Paths

Phil,

I was hoping to be able to do it without accessing the registry. I am aware
where the settings are being stored, but what happens if MS moves them etc
etc? What happens if the local user doesn't have admin rights and so I
can't access that part of the registry?

Matthew



Quote:
> Interesting poser, I checked the Win95 OSR2.1 Registry and sure enough
there
> were application EXE file entries. For example i have an entry for
> DirectCD.EXE and if i read the registry key i can run the program from
> Start->Run just by typing the EXE name, i have tried the following
program
> example i created a registry key when my program was installed and from
then
> on it could be run from the Start->Run menu.

> In answer to the question you will have to read in the registry key that
> haves the EXE file as its key name under ;
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
> and then read in the path to and then add it to the shell statement
etc...

> As for the ShellExecute API call it allows you to act upon different
events
> that programs are related to : for example ShellExecute
> "Open","http://www.microsoft.com" would load the default web browser and
> then navigate to microsoft.com, (Note the ShellExecute code will not
work,
> its missing a few extra param's).

> Hope this helps,

> Phil.



Sun, 22 Oct 2000 03:00:00 GMT  
 App Paths

To get the command prompt to behave like the Run dialog box, simply place
the command 'start' in front of it.  That will search the registry for you.

i.e.:  'start pinball' will launch Windows' pinball game (if installed)

Hope this helps,

Tim

<<snip>>

Quote:
>The technique used above only works when launching apps from File Manager
>or Start -> Run. It DOES NOT work when you try and use it from a command
>prompt (cmd) or using VB's shell command. So, shell("Winword") would not
>work (which is essentially what I want).

>So my question is:

>1) Does anyone know to (using VB) launch an app in a fashion similar to
>Explorer and File Manager (ie. taking notice of entries in
>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths).



Thu, 26 Oct 2000 03:00:00 GMT  
 App Paths

Tim,

Thanks - I will give it a try. Most useful suggestion so far!

Matthew



Quote:
> To get the command prompt to behave like the Run dialog box, simply place
> the command 'start' in front of it.  That will search the registry for
you.

> i.e.:  'start pinball' will launch Windows' pinball game (if installed)

> Hope this helps,

> Tim


> <<snip>>
> >The technique used above only works when launching apps from File
Manager
> >or Start -> Run. It DOES NOT work when you try and use it from a command
> >prompt (cmd) or using VB's shell command. So, shell("Winword") would not
> >work (which is essentially what I want).

> >So my question is:

> >1) Does anyone know to (using VB) launch an app in a fashion similar to
> >Explorer and File Manager (ie. taking notice of entries in
> >HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths).



Thu, 26 Oct 2000 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Paths and App.Path

2. using application path (app.path)

3. App.Path only returning short path name - Why?

4. app.path only returns short path name

5. Help: App.Path returns 8.3 path in VB4/Win95

6. app-path and mdb-path

7. App.Path returns "short" path name

8. URGENT: app.path

9. App.path

10. Using app.path

11. App.Path in NT or 2000 OS

12. Word97 - App Paths

 

 
Powered by phpBB® Forum Software