Windows 7 Double-Click On Data File To Open App

MikeRox

Member
Hello. I am new to this forum. Have posted this to a Visual C++ forum too. They suggest I try a Windows forum. I have a small app created with Visual C++ running on Windows 7 Pro. It runs fine when executed from within the V++ IDE. It runs fine if I simply double-click on the .exe file. I would also like my users to be able to double-click on one of the associated data files (my own .spv format), and have the sim run taking that file as input. Was hoping that I could simply associate .spv files with my sim and that the data file would be accessible to main (argv, argc). It almost works. My sim is fired up when I click on an .spv file, and the correct data file name is recognized in main. However, I also get an error message panel from windows (?) listing the acceptable command line options such as -i, -bg2 -di, -na, -ti, etc. This panel interrupts the execution of my app. Once I close it everything runs fine. Anyone know what's going on here? I've been working for about 6 hours trying to iron this out (reasoning, guessing, forums etc). Any help is greatly appreciated.
 
Hi Mike,
welcome to the forum. Your query isn't really my area of expertise but one of my colleagues may know I'll pm him and see if he'll check your issue over.
 
Let me make sure I understand.. you've written an application in C++ that takes the command line parameters -i, -bg2 -di, -na, -ti? Or are you calling a 3rd party application that is doing this sim and it's what is firing up the program usage? I'm not completely clear on your question.
 
Let me make sure I understand.. you've written an application in C++ that takes the command line parameters -i, -bg2 -di, -na, -ti? Or are you calling a 3rd party application that is doing this sim and it's what is firing up the program usage? I'm not completely clear on your question.
Your response hit the nail on the head. I've written my own app - BUT it calls a GUI library with argc and argv. Forgot about that. My bad. The 'command line parameters' are used by the GUI app to open a window. The error panel I was getting was from the GUI app. I didn't understand that until LATE last night. It would have helped if the error panel had said something less vague than 'Error'. Bottom line - that problem is solved. I change argc to 1 before calling the GUI app. Thanks for your response. Can't do skype. I'm working behind a firewall.
 
When passing a file argument you may also want to enclose it's path in quotation marks as well, I'm a developer too I've dealt with similar situations ;)

Glad you figured it out.
 
Back
Top