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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Starting VB Application from File Selection 1

Status
Not open for further replies.

donallan

Programmer
May 6, 1999
6
CA
In writing a VB project I have added the file association to specific file type created when user saves his/her work. Double clicking this file in Explorer will launch my application but will not load the file into the program.

Can anyone give me pointers on how to get my program to load a specific file into an application from selection outside the application?
 
You need to set up your file association so that it invokes your program like:
Code:
C:\Program Files\WizzyCorp\MyProg.exe %1
In your program you use the
Code:
Command
variable (built in) to retrieve the string passed to your program on the "command line" by Windows. The %1 will have been replaced by the name of the file you want to process.

Then you need to use the string value of
Code:
Command
to open the file in your program.

You might need to use "%1" in case the file name has spaces or anything in it or its path.
 
Many thanks. Learned something new today! You pointed me in the right direction and solved my problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top