Find path where WinZip is installed

  • Thread starter rdemyan via AccessMonster.com
  • Start date
R

rdemyan via AccessMonster.com

Is there a way that I can determine the full path of an application like
WinZip. If possible, I'd like to start with as little information as
possible, (Example WinZip).
 
R

Richard

Is there a way that I can determine the full path of an application like
WinZip.  If possible, I'd like to start with as little information as
possible, (Example WinZip).

Click on start --> programs --> find win zip, right click on win zip,
click properties.
 
D

Douglas J. Steele

Take a look at what Randy Birch has at
http://vbnet.mvps.org/code/system/findexecutable.htm

If you change the line of code

success = FindExecutable("winhlp32.hlp", "c:\winnt\system32\", sResult)

to point to a known Zip file, like

success = FindExecutable("MyFile.zip", "C:\SomeFolder", sResult)

then sResult will contain the path to winzip32.exe
 
D

Douglas J. Steele

Oops. Just noticed I was missing the final slash on the folder:

success = FindExecutable("MyFile.zip", "C:\SomeFolder\", sResult)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Douglas J. Steele said:
Take a look at what Randy Birch has at
http://vbnet.mvps.org/code/system/findexecutable.htm

If you change the line of code

success = FindExecutable("winhlp32.hlp", "c:\winnt\system32\", sResult)

to point to a known Zip file, like

success = FindExecutable("MyFile.zip", "C:\SomeFolder", sResult)

then sResult will contain the path to winzip32.exe
 
R

rdemyan via AccessMonster.com

Thanks, Doug. My App uses WinZip to upload zipped files to an ftp site. I
recently purchased a new computer which is 64 bit. Programs are stored in
the folder Program Files (x86) and not Program Files. Since my code has a
hard coded reference to the path (which was presumed to be Program Files), my
program can no longer find WinZip.

I had forgotten that My App has this vulnerability. I wish there was another
way to find WinZip than what you suggest, since it requires knowing the file
name of a zip file on the user's computer. I've decided to start storing the
full path in a local table. If MyApp can't find it, it will ask the user to
locate WinZip via File Search code. Then Myapp will store the full path for
future use.

However, I would prefer to be able to find it in code.

Also, what happens when WinZip32 becomes Winzip64??




Oops. Just noticed I was missing the final slash on the folder:

success = FindExecutable("MyFile.zip", "C:\SomeFolder\", sResult)
[quoted text clipped - 12 lines]
 
D

Douglas J. Steele

AFAIK, the API call will detect the currently registered application for the
..zip extension whether it's WinZip32 or WinZip64.

You should be able to simply write out a dummy file with the .zip extension
and find the registered application using that dummy file: I believe the API
call strictly looks at the file name, not whether it's a valid file.

Another option, of course, is to go speleunking through the HKCR section of
the registry.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


rdemyan via AccessMonster.com said:
Thanks, Doug. My App uses WinZip to upload zipped files to an ftp site.
I
recently purchased a new computer which is 64 bit. Programs are stored in
the folder Program Files (x86) and not Program Files. Since my code has
a
hard coded reference to the path (which was presumed to be Program Files),
my
program can no longer find WinZip.

I had forgotten that My App has this vulnerability. I wish there was
another
way to find WinZip than what you suggest, since it requires knowing the
file
name of a zip file on the user's computer. I've decided to start storing
the
full path in a local table. If MyApp can't find it, it will ask the user
to
locate WinZip via File Search code. Then Myapp will store the full path
for
future use.

However, I would prefer to be able to find it in code.

Also, what happens when WinZip32 becomes Winzip64??




Oops. Just noticed I was missing the final slash on the folder:

success = FindExecutable("MyFile.zip", "C:\SomeFolder\", sResult)
[quoted text clipped - 12 lines]
WinZip. If possible, I'd like to start with as little information as
possible, (Example WinZip).
 
R

rdemyan via AccessMonster.com

Oh, OK. If the API doesn't care if it is a valid zip file, then that should
work fine. I'll give it a go and report back.

Thanks.
AFAIK, the API call will detect the currently registered application for the
.zip extension whether it's WinZip32 or WinZip64.

You should be able to simply write out a dummy file with the .zip extension
and find the registered application using that dummy file: I believe the API
call strictly looks at the file name, not whether it's a valid file.

Another option, of course, is to go speleunking through the HKCR section of
the registry.
Thanks, Doug. My App uses WinZip to upload zipped files to an ftp site.
I
[quoted text clipped - 30 lines]
 
R

rdemyan via AccessMonster.com

It turns out that the API requires a file that exists. Not only that, but
the path folder must also be accurate.

I guess I could try to create a zip file in code in the CurrentProject.Path
folder, get the location of WinZip and then save that location to a local
table within MyApp. Before this code is invoked, I'll have code that checks
to make sure Winzip exists based on the path currently stored in the table.
If not, then the code to create the dummy WinZip file will be invoked and the
API will be called to get the location of WinZip. Afterwards, the dummy zip
file will be deleted.


Oh, OK. If the API doesn't care if it is a valid zip file, then that should
work fine. I'll give it a go and report back.

Thanks.
AFAIK, the API call will detect the currently registered application for the
.zip extension whether it's WinZip32 or WinZip64.
[quoted text clipped - 11 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top