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)