ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Display picture on Green Screen

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

  • Display picture on Green Screen

    Does anyone have any experience with displaying pictures (jpeg, tiff, etc) in a green screen environment?
    This would be where a user would be in a product information screen and they would have the ability to view a photo of the product.
    If so, please supply code snippets.

    Greatly appreciated.

  • #2
    Re: Display picture on Green Screen

    Hi Karen:

    Give this a try:
    Code:
    pgm                                                                    
    dcl &lecmd    *char 1024           
                                        
    chgvar &lecmd value('rundll32 shell32,ShellExec_RunDLL "C:\inetpub\+   
     wwwroot\welcome.png"')   
                                                 
                 STRPCO                                                    
    monmsg (cpf0000 iws0000)                                               
                 STRPCCMD   PCCMD(&LECMD) PAUSE(*yes)                      
                 CHGVAR &LECMD VALUE(' ')                                  
                 ENDPGM
    Best of Luck
    GLS
    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

    Comment


    • #3
      Re: Display picture on Green Screen

      I am getting the following error:
      Error in Shell32
      Missing Entry:Shellexec_rundll

      Comment


      • #4
        Re: Display picture on Green Screen

        This works for me:
        Code:
        PGM                                       
        STRPCO     PCTA(*NO)                      
        MONMSG     MSGID(IWS4010)                 
        STRPCCMD   PCCMD('START +                 
                     c:\Test\logo.png') PAUSE(*NO)
        ENDPGM
        Just call this CLLE and it uses the default program on your PC to display the image. You can of course modify this to accept the image name as a parameter.

        Similarly, this should work to start google in your default browser:
        Code:
        PGM                                                       
        STRPCO     PCTA(*NO)                                      
        MONMSG     MSGID(IWS4010)                                 
        STRPCCMD   PCCMD('START http://www.google.com') PAUSE(*NO)
        ENDPGM
        Last edited by Viking; November 5, 2013, 03:54 PM.

        Comment


        • #5
          Re: Display picture on Green Screen

          The ShellExec_RunDLL will not work on Windows 7 and up. For some unknown reason, Microsoft removed that API.

          Please PLEASE do not use 'start'. I swear, I spend half of my days trying to fix problems people have with STRPCCMD because they use 'start'. When you use 'start', it will force the use of the MS-DOS command interpreter, and it has many more situations where characters (especially the & character) will cause problems. It also opens up an ugly black DOS window. It doesn't make sense to use 'start' when your goal is to run a Windows program.

          Instead, use 'explorer', which forces the use of Windows Explorer and works fine on newer versions of Windows.

          Code:
          PGM                                       
          STRPCO     PCTA(*NO)                      
          MONMSG     MSGID(IWS4010)                 
          STRPCCMD   PCCMD('explorer +                 
                       c:\Test\logo.png') PAUSE(*NO)
          ENDPGM

          Comment


          • #6
            Re: Display picture on Green Screen

            Thanks Scott, I was unaware of the use of 'explorer'. I've don't recall having issues with using 'start' (although I do see the little black DOS window briefly), but I will change to using 'explorer'. I just tested it for several scenarios and it seems to work great.
            Last edited by Viking; November 5, 2013, 04:26 PM.

            Comment


            • #7
              Re: Display picture on Green Screen

              Originally posted by Viking View Post
              I've don't recall having issues with using 'start' (although I do see the little black DOS window briefly), but I will change to using 'explorer'.
              Sorry I was so grumpy before! I'm just frustrated because I had 3 messages today from people using 'start' who were having problems.

              the trouble occurs when you have blanks in your path name, or when you have the & character in a path name. The & character is commonplace in URLs, and the blanks are commonplace in local path names. So for example, try this:

              Code:
              STRPCCMD PCCMD('start "I:\Picture 014.jpg"')
              vs.
              STRPCCMD PCCMD('explorer "I:\Picture 014.jpg"')
              I think you'll find that the 'explorer' command works, but the 'start' does not, because of the blank in the file name. Likewise, try this:

              Code:
              STRPCCMD PCCMD('start "http://maps.google.com/maps?output=embed&q=1600%20Pennsylvania%20Ave,%20Washington%20DC"')
              vs.
              STRPCCMD PCCMD('explorer "http://maps.google.com/maps?output=embed&q=1600%20Pennsylvania%20Ave,%20Washington%20DC"')
              The & symbols (and maybe the % symbols, I'm not sure) cause havok with 'start', but with 'explorer' they work fine.

              Comment


              • #8
                Re: Display picture on Green Screen

                Yes, I can see that 'explorer' is a better way to go - thanks!

                Btw, I notice that with 'explorer', my session is input-inhibited until I put the focus back on the emulation window, but with 'start' it behaves slightly differently in that the session does not seem to stay input-inhibited. I noticed it because I have two monitors - one I generally use for green-screen, and one for everything else. Anyway, not sure that it matters, although I wonder if maybe the green-screen program is running until it gets the focus back for some reason.

                Does yours display that same behavior?
                Last edited by Viking; November 5, 2013, 05:25 PM.

                Comment


                • #9
                  Re: Display picture on Green Screen

                  Originally posted by Viking View Post
                  Btw, I notice that with 'explorer', my session is input-inhibited until I put the focus back on the emulation window, but with 'start' it behaves slightly differently in that the session does not seem to stay input-inhibited.
                  This happens with IBM i Access ("Client Access"). When you switch focus back to the PC5250 window, it stops being inhibited (you do not need to close the image you're displaying or anything like that.) It does this with any Windows program (but not DOS programs, I think) that I launch.

                  The other 5250 emulation software programs that I use (the open source TN5250 and Profound Logic's Genie) do not do this, however, just IBM's. Not sure why they do that, but I suspect it has something to do with timing. The windows program runs asynchronously, so if you were to launch a bunch of commands one after the other, Windows could potentially execute them in a different sequence than you ran them in. But, if the emulator waits until it gets focus back, it knows that the first program ran already and completed, and therefore it's safe to run the second one. Just a guess on my part, though.

                  This wouldn't happen in a DOS launch because the DOS window is opened asynchronously, but then it runs a windows program which launches yet another process asynchronously, and then the DOS process ends (allowing the emulator to continue...) So you're launching two processes, but the first one is ending and that is allowing the emulator to continue.

                  Comment


                  • #10
                    Re: Display picture on Green Screen

                    Note that if you run a DOS command that does not launch another asyncrhonous process (such as an actual DOS program rather than a Windows program -- one that doesn't end immediately) it will behave just like when you use explorer. I realize that not too many people still have DOS software on their systems, but... an easy test is to run Microsoft's "pause" program that just waits for you to hit a key. Like this:
                    Code:
                    STRPCCMD PCCMD('pause')

                    Comment

                    Working...
                    X