Announcement

Collapse
No announcement yet.

Controlling Irfanview through command line options

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Controlling Irfanview through command line options

    At the moment, I'm trying to command Irfanview to open images in fullscreen mode with a program I've written. Unfortunately, it uses the MinGW compiler and uses forward slashes for path names as opposed to backslashes

    i.e.

    Normal command prompt: i_view32.exe c:\blarg.bmp /fs

    MinGW: i_view32.exe c:/blarg.bmp /fs

    Anyone know how to work around this issue? Also, can Irfanview open .TIFF images from the command line options, and, if so, what is the command? I get header problems whenever I try to open non-BMP images.

    EDIT: MinGW allows me to do a // for an forward slash based argument, but I still have the issue that

    i_view32.exe /c/blarg.bmp

    does not put the image on screen, whereas with the normal windows command prompt it does.
    Last edited by Ragnarok22788; 18.06.2011, 09:38 PM.

    #2
    c++?

    How do you get the filepathname?
    From cin, argv or hardcoded?

    steve

    Comment


      #3
      Originally posted by steve View Post
      c++?

      How do you get the filepathname?
      From cin, argv or hardcoded?

      steve
      I've hardcoded the path name and I simply concatenate different strings based on which image I want to pull up. So I have preset strings

      "i_view32.exe c:/image"

      ".bmp /fs"

      and shove a number between the two based on which image I want to pull up

      i_view32.exe c:/image0.bmp /fs

      If I do this in the windows command prompt, it works just fine (with backslashes), but, with my MinGW compiler, nothing works even if I try to just command it directly from the MinGW command prompt. Unfortunately, I do not know how to do a system call in my c++ file for a different compiler than the MinGW compiler I'm using to make my code. My goal was to have my code simply do a system call like

      system("i_view32.exe c:\image0.bmp /fs")

      Comment


        #4
        Hi,

        and

        string imagePathName = "C:\\image0.bmp";

        won't be recognized by the compiler?

        I just tested "c:/Windows" on my win7 machine, it is automatically correcting the path to "c:\Windows". But i was using the pathname in the windows explorer. On my win7 machine I only have vs2010 installed.

        Gcc on my debian machine can work with \ and / - when you "double" excape the path limiters correctly.

        steve

        Comment


          #5
          Originally posted by steve View Post
          Hi,

          and

          string imagePathName = "C:\\image0.bmp";

          won't be recognized by the compiler?

          I just tested "c:/Windows" on my win7 machine, it is automatically correcting the path to "c:\Windows". But i was using the pathname in the windows explorer. On my win7 machine I only have vs2010 installed.

          Gcc on my debian machine can work with \ and / - when you "double" excape the path limiters correctly.

          steve
          What you suggested worked great! Now the issue is that my program switches to the irfanview window whenever the image is loaded through the command line and, as a result, my program stops running. It's really curious because as soon as I close the irfanview window, my program starts running again, for a moment, till the next image loads where it then stops.

          Thanks a lot for your previous suggestion. It was really helpful!

          Comment


            #6
            Hi,

            try to use the windows api function called "ShellExecute" instead of "system()", see reference here

            with

            Code:
            ShellExecute(NULL, "open", "i_view32.exe", "image.bmp", NULL, SW_SHOWNORMAL);
            or SW_SHOWMAXIMIZED for you needs.

            Included headers should be

            Code:
            #include <windows.h>
            and

            Code:
            #include <shellapi.h>
            steve

            Comment


              #7
              Originally posted by Ragnarok22788 View Post
              Now the issue is that my program switches to the irfanview window whenever the image is loaded through the command line and, as a result, my program stops running. It's really curious because as soon as I close the irfanview window, my program starts running again, for a moment, till the next image loads where it then stops.
              That is the same as happens in a batch file script running under cmd.exe where "i_view32.exe c:/image" is treated as a subroutine CALL of the i_view32.exe process. So the script waits for i_view32.exe to terminate before continuing to the next command. To just start i_view32.exe and continue without waiting for it to terminate you use the START command i.e. "START i_view32.exe c:/image".
              Perhaps your compiler supports that form as well.

              Comment


                #8
                Another solution: Start your i_view32.exe in a new thread (actually I can only show you this in c#, but not in c++) so every new instance of IrfanView has it own process and you can "process" more commands without blocking one single i_view32.exe thread.

                Comment


                  #9
                  Thanks a ton for all of your help guys! I've got the ShellExecute approach working, but I'm playing with the DestroyWindow() function now to prevent getting too many windows to fly up at once. After I get this done, I will look into threading since it seems really useful!

                  Comment

                  Working...
                  X