I cannot find how I’m supposed to handle file opening in my program. For example if the user does Open With … myprogram.exe then how do I handle that and do something with it. which WM_Message is sent?
Thanks
*no I mean if you have sometext.txt and openwith Notepad.exe, it magically displays the text, so how can I know if someone used Open With.
There is no message sent, you will probably get it on the commandline, use argc/argv or GetCommandLine()
The shell first checks for a NoOpenWith value in KCR\Applications\myprogram.exe if it is not there, your app is listed in the open with dialog.
If the user chooses your app, the shell will use the command listed under HKCR\Applications\myprogram.exe\shell\open\Command if it exists (You could then assign DDE or Droptarget properties if that is how you want to handle the “incoming files”)
If you really want to know if openwith was used, I guess you could register a command under the shell key that executes your app with a command line like myprogram.exe /openwith “%1”