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

Detecting File That Initiated VB Application 1

Status
Not open for further replies.

dpatrickcollins

Programmer
Nov 18, 2002
79
I wish to write a VB application that supports its own file types, i.e. when a file is double-clicked in Windows, the application will start and display the file. I have successfully configured the file association in Windows, no problem. But question for the geniuses out there: once the file initiates the application, how do I make sure the file is opened?
 
The path of the file that initiated the program is passed to the application as command line argument.

This also needs that you have specified the correct command line when creating your file association. This is done by appending command line with a %1 or %L.

The command line data in the registry will look like this.

HKEY_LOCAL_MACHINE
yourfiletype\Shell\Open\command
(default)="Your application path" %L

After the application has started, you can check the value of Command$ function. This function contains the path of the document that started the application. If the application is started directly in standalone mode, this function returns vbNullString.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top