mcdonald_g
asked on
Code to open file automatically by association
I am looking for the code to open an associated file automatically. For example, I have created a VB application which opens and read files with the extension .PAG
When a user double-clicks on a file with the extension of .PAG in Windows Explorer, I want the VB application to open that particular file after starting.
When a user double-clicks on a file with the extension of .PAG in Windows Explorer, I want the VB application to open that particular file after starting.
ASKER
The code I am looking for is strictly VB syntax. I already have the association set in Windows Explorer.
I need the VB code to open the file that was double-clicked in Explorer.
Right now when I double-click on a filename with an extension of .PAG, my VB app launches but it doesn't open the file. I need to plug in code to open the file after the app starts.
I need the VB code to open the file that was double-clicked in Explorer.
Right now when I double-click on a filename with an extension of .PAG, my VB app launches but it doesn't open the file. I need to plug in code to open the file after the app starts.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
When the program starts, check the value of the Command function. It should be the filename if your program was started from clicking on an associated file.
ASKER
Thanks a lot! It worked.
windows asks what to use.
browse to your app, check the "always use this program" and OK.
If you want to do this programattically, use the api viewer to add registry funcs.
Go HKey_CLASSES_Root and find your key(s), simply emulate this.
Moshe.