Id which file called app

Ross

Member
Joined
Apr 20, 2006
Messages
7
Location
Northants, UK
Programming Experience
1-3
Hi,
I have a "front loader" with opens up a excel app. I would like to know how the front loader exe was called. What i mean is, I have some data files with an file extention which i have "mapped" to my front loader, ie. open with. So when you dobbule clcik one of them it opens the excel app but does not load the data.
To do this i need to be able to:
- id if the front loader app was called in it's own right or by another file.
- get the path of the data file which called it and pass this to my excel app.

Any ideas, links, code very welcome
Thanks
Ross.
 
If you have set up the file associations with the "%1" parameter you will find the full path of filename in second element of the array returned from Environment.GetCommandLineArgs Method
 
Hi
thanks
No I did not set up the file assocuation like this - but i will look into it.

is there such a thing like me.Creator whcich details how a user form was
initialize

Thank you
Ross
 
Hi just to tie this up, I did not use anything like

AddCommand("open", "C:\mydir\myprog.exe %1")

I just set the open with with the context menu in windows - i plan to set the associations up during the install. However the Environment.GetCommandLineArgs still had the full file path of the called, in about agu 4.

Cool, thanks for the help
Ross
 
Yes, you can use explorer to set up the file association. You can also change it there with Tools, Folder Options, Filetypes, select type and click Advanced, Edit verb. If you instead of %1 put "%1" the filename will not split by spaces, so the complete filepath will be in second array element.

Here is a walk-through on setting up File Types for a Setup project: http://www.vbcity.com/forums/topic.asp?tid=72258
 
w

Hi John,
Thanks for the link:
Overe the week end i was looking at set up projects in the help file, but i could not find the set up project type in the template - I am using VBE so that why i guess it's not there. I'll have a look at shrap # to see if there's one in there, but failing that i'll look at some 3rd party prog - i have one bookmarked already - or just write my own.

Thanks Agian
Cheers
Ross
 
Guess that is one of the shortcomings of the ClickOnce of VS2005 Express and Standard, another is you can't add scripting to the installer so you can't add the registry code for it there either. The example was VS2003 which got Installer (Setup Project), also VS2005 Pro got Installer.

The alternative is to do the "hard way" as described in article linked, and do it in application code. Do a check in application startup, if file associations are not already added do it then.
 
Hi John,
thanks
I installed this http://www.advancedinstaller.com/feats-list.html, it does do file assioactions, but not in the free mode. Sharp #, does not seem to have a set up project as yet.
I looked at the "hard way" - Thanks agian for the link. What do you think would be the best way to use this code - would you set a registry flag after it has run the first time and skip it on all the following times the programe is run, i.e

if FlagFileAss then
exit sub
else
SetFileAss
end if

or would you put it in a diffrent progame all together, run it at insatllation and then forget about it?
Cheers
Ross
 
ClickOnce: If you can't modify the install script you can't make it run another app when installing either, so then you would have to do the flag thing or just check if one of the specific registry values is valid on regular app startup.
I saw the Caphyon AdvancedInstaller Free didn't do file associations but does registry when install. Never heard of it before, I will try it out soon, thanks!
 
Back
Top