open file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mirko

    #1

    open file

    How to open file from a FileListBox.

    ..zip with winzip
    ..pdf with Acrobat Reader



  • CajunCoiler \(http://www.cajuncoiler.tk\)

    #2
    Re: open file

    Either file can be opened by using the ShellExec API call, which will
    open the file (of any type) with the program that it's associated to.

    "mirko" <mirko.despotov ski@vt.tel.hr> wrote in message
    news:bfvt5b$50h $1@brown.net4u. hr...[color=blue]
    > How to open file from a FileListBox.
    >
    > .zip with winzip
    > .pdf with Acrobat Reader[/color]


    Comment

    • HKSHK

      #3
      Re: open file

      Hello Mirko,

      An easier way for opening the file is this:

      Dim ReturnValue As Variant

      ReturnValue = Shell("start " & Chr$(34) & "filename.z ip" & Chr$(34))
      ReturnValue = Shell("start " & Chr$(34) & "filename.p df" & Chr$(34))

      The result is the same as if you use the ShellExec API call, but it's
      easier to use, because the Shell function returns you the program's
      task ID if successful, otherwise it returns 0.

      The Shell function runs asynchrouneous, which means that your routine
      will continue after sending the "Start" command to Windows. This might
      be a disadvantage, if you have to wait for a procedure to finish
      before your program can continue.

      Kind Regards,

      HKSHK

      Comment

      • HKSHK

        #4
        Re: open file

        Hello Chris,

        I see no reason why I should make an API call if it's not necessary,
        just to please some idiots. As long as it is not required to wait
        until the called program has ended I use the Shell function. I usually
        don't try to please everyone, because it won't work anyway.

        Kind Regards,

        HKSHK


        "CajunCoile r \(http://www.cajuncoiler .tk\)" <cajuncoiler@to tallyspamless.c ox.net> wrote in message news:<0FFVa.108 11$5b7.798@lake read01>...[color=blue]
        > I'd thought of that, but usually when I mention the Shell function around
        > here, it's usually followed by a firestorm of messages, that say to use
        > the API call... just tried beating the angry mob to the punch.
        >
        > "HKSHK" <hkshk@gmx.ne t> wrote in message
        > news:37464b94.0 307281941.47473 85b@posting.goo gle.com...[color=green]
        > > Hello Mirko,
        > >
        > > An easier way for opening the file is this:
        > >
        > > Dim ReturnValue As Variant
        > >
        > > ReturnValue = Shell("start " & Chr$(34) & "filename.z ip" & Chr$(34))
        > > ReturnValue = Shell("start " & Chr$(34) & "filename.p df" & Chr$(34))
        > >
        > > The result is the same as if you use the ShellExec API call, but it's
        > > easier to use, because the Shell function returns you the program's
        > > task ID if successful, otherwise it returns 0.
        > >
        > > The Shell function runs asynchrouneous, which means that your routine
        > > will continue after sending the "Start" command to Windows. This might
        > > be a disadvantage, if you have to wait for a procedure to finish
        > > before your program can continue.
        > >
        > > Kind Regards,
        > >
        > > HKSHK[/color][/color]

        Comment

        • Donald Brady

          #5
          Re: open file

          CajunCoiler (http://www.cajuncoiler.tk) wrote:[color=blue]
          > I'd thought of that, but usually when I mention the Shell function around
          > here, it's usually followed by a firestorm of messages, that say to use
          > the API call... just tried beating the angry mob to the punch.
          > When running a program via the shell command: Any easy way to know when the program has ended?[/color]

          Comment

          Working...