Results 1 to 7 of 7

Thread: First one to give me a proper answer to this within 20 minutes gets on our board!

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2016
    Posts
    2

    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!

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Lively Member
    Join Date
    Feb 2012
    Posts
    72

    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?

  4. #4
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    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.

  5. #5
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    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



  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2016
    Posts
    2

    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
  •  



Click Here to Expand Forum to Full Width