Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

the "getpath" command

Status
Not open for further replies.

Hala73

Programmer
Sep 6, 2003
13
0
0
US
hi,

I am trying to make my vb program find the path of the msn messenger application (I want this to be done automatically on which ever computer it is downloaded).
The code I use is returning the wrong path: that of the vb executable itself.
Here's my code:

Dim fso
Dim newpath As String
Set fso = CreateObject("Scripting.FileSystemObject")
newpath = fso.GetAbsolutePathName("MSNMSGR.EXE")
Print newpath 'to check if it's working

any suggestions?
Thanks
Hala
 
Dim fso
Dim newpath As String
Set fso = CreateObject("Scripting.FileSystemObject")
newpath = fso.GetAbsolutePathName("MSNMSGR.EXE")
Debug.Print newpath 'to check if it's working

In my computer works well your code

peterguhl@yahoo.de
 
I finally figured out the code I've been posting questions about!!

What I did is look for the path of the .exe file based on its location in the registry.
It's a portable code that can find the msn 6.0 application on its own and open it!

Option Explicit
Private sAppPath1 As String, sAppPath2 As String
Private Sub Command1_KeyPress(KeyAscii As Integer)
Call Shell(sAppPath, vbMinimizedFocus)
End Sub
Private Sub Form_Load()
Dim objWSH As Object
Set objWSH = CreateObject("WScript.Shell")
Dim y As String
y = objWSH.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\6378366C4007D1E45ACB03110040FE5C\C838BEBA7A1AD5C47B1EB83441066020")
Print y
sAppPath = y
End Sub

Thanks for the help with some of it!
Hala
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top