Can anyone tell me how a program like notepad knows when it has been opened to read a file. How does it tell weather you are running the program using notepad.exe or by double clicking on a *.txt file. Here's an example of what I mean.
I want to open a readme.txt file so I double click on it and notepad pops open with the contents of the file. What I want to know is how does notepad know thats it is supposed to open this file and display the contents and not just display an empty file like it does when you click on the notepad.exe file?
Any help is appreciated.