|
-
Feb 18th, 2016, 08:07 PM
#1
Thread Starter
New Member
First one to give me a proper answer to this within 20 minutes gets on our board!
How would you go about finding the file in which the application was started from.
In simpler terms.. You set the open with to be your application, how would you go about finding the file the application was started from using pure code. And at that even checking if it was opened using open with?
First one to give me a proper answer to this within 20 minutes gets on our board!
-
Feb 18th, 2016, 08:39 PM
#2
Re: First one to give me a proper answer to this within 20 minutes gets on our board!
Your wording is a bit off... the application isn't started from a file... it's simply started... the file name is then passed to the application through the command line. So when the app starts, you check the application command line arguments and Robert's your father's brother.
-tg
-
Feb 18th, 2016, 09:03 PM
#3
Lively Member
Re: First one to give me a proper answer to this within 20 minutes gets on our board!
its just a guess, but i think the OP means file association, like a .DOC file being associated with MS Word, if you double click the .DOC file word opens with that file load
im not sure about finding out if the 'open with..' dialog was used.
i haven't actually tried anything like this in vb.net but you could try path.GetDirectoryName or Directory.GetCurrentDirectory - i think it depends on what your doing, do you already have a project with an associated file?
-
Feb 18th, 2016, 09:06 PM
#4
Re: First one to give me a proper answer to this within 20 minutes gets on our board!
Well, it took 27 minutes for someone to answer, so I guess no one gets to see his glorious diving board.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Feb 19th, 2016, 04:42 AM
#5
Re: First one to give me a proper answer to this within 20 minutes gets on our board!
In simpler terms.. You set the open with to be your application
its just a guess, but i think the OP means file association, like a .DOC file being associated with MS Word
Yep that's what i thought too.
File Associations are a registry setting under HKEY_CLASSES_ROOT - take a look at this
Please Mark your Thread "Resolved",  if the query is solved & Rate those who have helped you
-
Feb 19th, 2016, 07:13 AM
#6
Re: First one to give me a proper answer to this within 20 minutes gets on our board!
Even with the registry though, the application has to be looking for it through the command line arguments. Which is what the registry setting does, sets up the call so that the file name is passed through as the %1 parameter. Which might also be the answer to knowing if it was opened with using "Open With" ... if you set the registry file association to include additional parameters... say a "/open" switch ... that argument would only be passed through using the Open command. The Open With wouldn't include it. Then in the command line arguments check in the app... you look for the /Open switch... if you find it, it was opened by double-clicking the file... if you don't find it, it was probably an Open with action.
-tg
-
Feb 23rd, 2016, 09:19 AM
#7
Thread Starter
New Member
Re: First one to give me a proper answer to this within 20 minutes gets on our board!
I already got the answer from CodeProject and they responded with the same thing, also I was testing website activity by saying you will get put on our board.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|