How do I receive an external file name from within an application?
-
:)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
-
:)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
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
-
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
Dave - many many thanks. I've been looking for this solution for what seems like days - good on ya!:)
-
Dave - many many thanks. I've been looking for this solution for what seems like days - good on ya!:)
:-D RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome