load file wit double click

This is a discussion on load file wit double click within the C++ Programming forums, part of the General Programming Boards category; while testing how can i make my program load the actual double clicked file in windows? i mean i have ...

  1. #1
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,422

    load file wit double click

    while testing how can i make my program load the actual double clicked file in windows? i mean i have associated my file type manually for now and on clicking it opens an instance of program but without loading the file itself. all command line loading is set up and i can acheive loading by dragging n drop a valid file onto the exe, but double click igores the file. what is the method to acheive this? my installer will handle it i am sure, but in the interim?
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,422
    apologies for the spelling i am using a phone!
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Assuming windows, both MSDN and my own tests indicate that when you set up a file association, what you get is the filename of the double-clicked file in argv[1].

    (The MSDN example I found is File Association Example (Windows) although the part about registering your extension with IANA may be overkill.)

  4. #4
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,422

    args

    that was my assumption that double clicking would provide the args required no worries, its not happening that way though. i will test on a different machine and read article you posted, cheers.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  5. #5
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,422
    haha, you werent wrong about the iama stuff, i think i will just wait till millionth copy sold before i worry bout the file extension police coming knocking!
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  6. #6
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    681
    Just look up in the registry how the other files' associations are stored (or google it). Based on the this define your own with customized command line.
    I never put signature, but I decided to make an exception.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 03:09 AM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. functions and passing data
    By redmondtab in forum C Programming
    Replies: 41
    Last Post: 09-21-2006, 12:04 PM
  4. Replies: 3
    Last Post: 03-04-2005, 01:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21