Help with opening file

I have created a text editor. When somebody right clicks a text file and selects open with from the context menu and they select my program, how do I get the name of the file in my program? Do I use the third argument of WinMain lpCmdLine?
Yes. The name of the file is listed as part of the command line used to execute the program. The 3rd param to WinMain contains the command line. You can print it to the screen (with MessageBox or something) to see how it's structured -- so you can extract the name of the file to open. (Or you could look at it through a debugger)
Last edited on
I always use CommandLineToArgvW() and GetCommandLineW() API, which gives you already formatted argc/argv style command line arguments.
Can CommandLineToArgvW() and GetCommandLineW() be used with gui application?
Yes. This is their purpose, simulating argc/argv you seen in console applications.
Topic archived. No new replies allowed.