how can get a file path when user double click on it such as word files?
-
hi. i create an application that user can save a file with .mnm extension. now i want to when user double click on this file, my application run and show the file content. such as a .txt file , that user double click on it, "note pad" run and show the content. my problem is that user click on a file can not get file's path. how can get file path ? tanks
-
hi. i create an application that user can save a file with .mnm extension. now i want to when user double click on this file, my application run and show the file content. such as a .txt file , that user double click on it, "note pad" run and show the content. my problem is that user click on a file can not get file's path. how can get file path ? tanks
If you have set up an association with a particular file type for your application, Windows will pass the file name to it as a command line argument when a file is selected. In the
static void main(string[] args)
method for your application, the file name can be referenced usingargs[0]
. If you need to set up the file association programmatically, there is an article here on CodeProject[^] that explains how to do it.Paul Marfleet
-
If you have set up an association with a particular file type for your application, Windows will pass the file name to it as a command line argument when a file is selected. In the
static void main(string[] args)
method for your application, the file name can be referenced usingargs[0]
. If you need to set up the file association programmatically, there is an article here on CodeProject[^] that explains how to do it.Paul Marfleet