Thread: Shell command filename variable.

  1. #1
    Registered User
    Join Date
    Mar 2010

    Shell command filename variable.


    I have programmed an application to combine tiff image files into 1 tiff file. The program works if I hardcode the filenames into the application.

    I also have created a shell command which allows me to launch the application by right clicking on a tiff file and clicking a customized option in the context menu.

    My question is, how do I pass the file name of the item I right clicked into a variable which can be used in my c++ code? Also, if I select multiple tiff files and then right click, is there a way to pass all 3 into an array?

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Jul 2008
    If you have your entrypoint main function defined as the following:

    int main (int argc, char* argv[])
    Then the argv array contains a list of strings which contain your parameters.

    argc is how many parameters were passed to your program, including the executable name i believe.

  3. #3
    Registered User
    Join Date
    Mar 2010
    Thank you, that is extremely useful.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about printing a variable???
    By Hoser83 in forum C++ Programming
    Replies: 2
    Last Post: 03-31-2006, 01:57 PM
  2. How accurate is the following...
    By emeyer in forum C Programming
    Replies: 22
    Last Post: 12-07-2005, 12:07 PM
  3. Use of variable
    By alice in forum C Programming
    Replies: 8
    Last Post: 06-05-2004, 07:32 AM
  4. Replies: 2
    Last Post: 04-12-2004, 01:37 AM