473,395 Members | 1,631 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

open file

How to open file from a FileListBox.

..zip with winzip
..pdf with Acrobat Reader

Jul 17 '05 #1
4 19988
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: yanivmad | last post by:
hi I like to ask if there any option to control the html files?!? I have some HTML files at my web site that use one "Help.htm" file for all the pages {I use the "window.open(.... " option at...
9
by: Charles F McDevitt | last post by:
I'm trying to upgrade some old code that used old iostreams. At one place in the code, I have a path/filename in a wchar_t string (unicode utf-16). I need to open an ifstream to that file. ...
6
by: Dino Buljubasic | last post by:
My application creates some temporary files that are deleted when my application terminates. However, if a temp file is open, it will not be deleted and application will crash. How can I...
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
6
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
2
by: OutdoorGuy | last post by:
Greetings, I have a "newbie" question in relation to opening files from C#. I have a Windows form where I allow the user to type in a file extension in a text box (e.g., "xls"). I then take...
6
by: Moumen VB.NET 2003/2005 Developer | last post by:
How can I detect if a file sitting on a network drive is still open by another application? This application resides on another machine on the network? I am using VB.NET 2003 Your help is...
5
by: Ryan Liu | last post by:
Hi, Both way works, I'd just ask some experts which way is better? My application creates a log file daily. Now each time when I write a log, I will open the file and append to the end....
6
by: Ros | last post by:
There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case...
0
by: Ofelia | last post by:
Hi, I'm new to this forum and to Perl language but I would like to ask for your help. I'm working in Linux and the files I need to process are in the format “file.gz”. I created a script which...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.