• [C++] How can I add Open-with functionality to my program?
    10 replies, posted
I'm trying to make it so that if a user of my program right clicks a text file, goes to "Open with", and selects my program, then my program will load the file in the text area. It's a text editor, by the way. The problem is, I can't figure out how the file is passed to the program as an argument, or how to access it. Help, please?
Do you mean this? [code]int main(int argc, char *argv[]);[/code]
argv[1 to argc - 1] will be the passed arguments (such as the file being passed to your program).
Just print out the args and see.
If it's windows... and your using %1 then argv[1] should be the filepath
Okay yeah it's just that with the default Windows forms template, the argument passed to args isn't the file. I even tested it by displaying args in a message box immediately after the program starts. I'm still new to this so your help is useful!
Think what you're looking for is a Shell extension. Look it up.
[QUOTE=MultiPurpose;18950123]Do you mean this? [code]int main(int argc, char *argv[]);[/code][/QUOTE] I was wondering how to do this because I never knew what to search. Thanks.
[QUOTE=Corewarp3;18959337]Think what you're looking for is a Shell extension. Look it up.[/QUOTE] No, he wants a file handler, which is != shell extension
[QUOTE=Corewarp3;18959337]Think what you're looking for is a Shell extension. Look it up.[/QUOTE] Uh, no? His "Edit With..." would be a setting in windows. No need for a shell extension.
[QUOTE=efeX;18961224]Uh, no? His "Edit With..." would be a setting in windows. No need for a shell extension.[/QUOTE] Why didn't you say that BEFORE i opened my mouth?(TYPED WITH MY HANDS) ._. Now i look stupid
Sorry, you need to Log In to post a reply to this thread.