Executing via Double-Click On Input File

Need help with this desperately please. I have an app which executes correctly from within Visual C++. It also runs fine from outside of VC++ when I double-click on the .exe file. I'd like my users to be able to execute the app by double-clicking on input files with an .spv extension. This ALMOST works. The app opens and I can access the input file as the second argument to main. The problem is that I also get an error window which says 'Error'. 'options are:' followed by a vertical list: "-bg2 color, -bg color, -di color," etc. Is the spv file also being taken as a command line argument by windows? Is this what is prompting the error box to show up? How can I prevent this? Thanks.

Greatly appreciate any help on this. Thanks.
You must have messed up the file association, delete all associations for SPV and then let your program associate it again.

By the way, this is less to do with C++ and more to do with Windows programming - you can edit the topic and move it to the correct forum.
Last edited on
> You must have messed up the file association, delete all associations for SPV ....

For a while I was having trouble with file associations. Think that's straightened out now. When I double click on one of my .spv files, my sim is fired up, and the correct file name is passed to main via argc and argv. But I also get that error panel. Can't have that. It halts the execution of my sim until I close it.

> less to do with C++ and more to do with Windows programming ...

I just posted this issue to a Windows forum too. Thanks for your feedback.
> The app opens and I can access the input file as the second argument to main.
> Is the spv file also being taken as a command line argument by windows?
If you can access it in argv[1] then I suppose it is.


> The problem is that I also get an error window which says 'Error'. 'options are:'
¿are those options of your program?
Can you screenshot this "error panel" and past the imgur link?
Some progress made -> by executing my app from the command line I found out what the source of that vague 'Error' panel was. It was coming from a gui library I use. It is initialized with argc and argv from 'main'. It did not understand the filename it was getting in argv. I fixed that by changing argc to 1 before the library gets called. Learned a lot by working through that.

I am still having trouble associating my .spv files with my app. But that's for tomorrow.
Last edited on
Wow, I'm pretty shocked that a GUI library is abusing your command line like that. Glad you figured it out.
Topic archived. No new replies allowed.