Double-Click On Data File To Open App

Discussion in 'Windows 7 Software' started by MikeRox, Aug 10, 2015.

  1. MikeRox

    MikeRox Member

    Joined:
    Aug 10, 2015
    Messages:
    4
    Likes Received:
    0
    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.
     
  2. kemical

    kemical Windows Forum Admin
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    Aug 28, 2007
    Messages:
    31,830
    Likes Received:
    1,565
    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.
     
  3. Josephur

    Josephur Windows Forum Admin
    Staff Member Premium Supporter

    Joined:
    Aug 3, 2010
    Messages:
    1,019
    Likes Received:
    125
    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.
     
  4. MikeRox

    MikeRox Member

    Joined:
    Aug 10, 2015
    Messages:
    4
    Likes Received:
    0
    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.
     
  5. Josephur

    Josephur Windows Forum Admin
    Staff Member Premium Supporter

    Joined:
    Aug 3, 2010
    Messages:
    1,019
    Likes Received:
    125
    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.
     
  6. kemical

    kemical Windows Forum Admin
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    Aug 28, 2007
    Messages:
    31,830
    Likes Received:
    1,565
    Thanks Josephur.. :)
     

Share This Page

Loading...