469,314 Members | 2,181 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,314 developers. It's quick & easy.

open file

How to open file from a FileListBox.

..zip with winzip
..pdf with Acrobat Reader

Jul 17 '05 #1
4 19891
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" <mi***************@vt.tel.hr> wrote in message
news:bf**********@brown.net4u.hr...
How to open file from a FileListBox.

.zip with winzip
.pdf with Acrobat Reader

Jul 17 '05 #2
Hello Mirko,

An easier way for opening the file is this:

Dim ReturnValue As Variant

ReturnValue = Shell("start " & Chr$(34) & "filename.zip" & Chr$(34))
ReturnValue = Shell("start " & Chr$(34) & "filename.pdf" & 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
Jul 17 '05 #3
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
"CajunCoiler \(http://www.cajuncoiler.tk\)" <ca*********@totallyspamless.cox.net> wrote in message news:<0FFVa.10811$5b7.798@lakeread01>...
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" <hk***@gmx.net> wrote in message
news:37**************************@posting.google.c om...
Hello Mirko,

An easier way for opening the file is this:

Dim ReturnValue As Variant

ReturnValue = Shell("start " & Chr$(34) & "filename.zip" & Chr$(34))
ReturnValue = Shell("start " & Chr$(34) & "filename.pdf" & 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

Jul 17 '05 #4
CajunCoiler (http://www.cajuncoiler.tk) wrote:
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?


Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Charles F McDevitt | last post: by
6 posts views Thread by Dino Buljubasic | last post: by
6 posts views Thread by qysbc | last post: by
2 posts views Thread by OutdoorGuy | last post: by
6 posts views Thread by Moumen VB.NET 2003/2005 Developer | last post: by
6 posts views Thread by Ros | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.