There are two parts of it: your application functionality + system registry settings related to the Shell.
On application part, you need to handle the command line parameters passed to your application when it is started. As this is C, you have an entry point called
main
. The OS loader of the applications passes the command line parameters
argc
, and
argv
as they appear in on of the following signatures
int main(int argc, char **argv);
int main(int argc, char *argv[]);
int main(int argc, char **argv, char **envp);
Please see:
http://en.wikipedia.org/wiki/Main_function#C_and_C.2B.2B[
^].
Your application should parse the command line, recognize file name(s) and try to load a file.
On the system registry side, you need to update the register to register the association between your application and some file type(s) recognized by the file name pattern (usually called "extensions", but this term is incorrect: there are no "extensions" in modern file systems; the letters after the last '.' character in file names are just the part of the file name). Please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/cc144158%28v=vs.85%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/windows/desktop/cc144156%28v=vs.85%29.aspx[
^].
—SA