Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How do I receive an external file name from within an application?

How do I receive an external file name from within an application?

Scheduled Pinned Locked Moved Visual Basic
questionalgorithmshelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alan Hallett
    wrote on last edited by
    #1

    :)I'm building an application to read and write formatted files on disk. I have associated the file extension (.fod) with the application and this works fine. When I double-click on a file in, say Windows Explorer, the application starts as it should. But I now need a way of finding the name of the clicked file within the application so I can open it. How do I do it? I've been searching the help systems and just not been able to find it, probably because I'm using the wrong terms. I've tried 'parameter', 'external parameter', "%1" and a whole host of others. Many thanks in advance for your help. Alan Hallett

    D 1 Reply Last reply
    0
    • A Alan Hallett

      :)I'm building an application to read and write formatted files on disk. I have associated the file extension (.fod) with the application and this works fine. When I double-click on a file in, say Windows Explorer, the application starts as it should. But I now need a way of finding the name of the clicked file within the application so I can open it. How do I do it? I've been searching the help systems and just not been able to find it, probably because I'm using the wrong terms. I've tried 'parameter', 'external parameter', "%1" and a whole host of others. Many thanks in advance for your help. Alan Hallett

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The parameter specifier is "%1". Keep the quotes around the %1 though. This will prevent file paths with spaces in them from being broken into multiple parameters. In your app, check into the Environment class and its CommandLine Property and GetCommandLineArgs method. Docs at MSDN[^] RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        The parameter specifier is "%1". Keep the quotes around the %1 though. This will prevent file paths with spaces in them from being broken into multiple parameters. In your app, check into the Environment class and its CommandLine Property and GetCommandLineArgs method. Docs at MSDN[^] RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        A Offline
        A Offline
        Alan Hallett
        wrote on last edited by
        #3

        Dave - many many thanks. I've been looking for this solution for what seems like days - good on ya!:)

        D 1 Reply Last reply
        0
        • A Alan Hallett

          Dave - many many thanks. I've been looking for this solution for what seems like days - good on ya!:)

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          :-D RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups