Open a file (any extension) on a local or network drive

How can I open a file with any extension through Clarion? I am able to save a file via FileDialog. But now I need to be able to open the file - preferably, without revealing the location of the file.

ShellExecute - for handcoders
Most of the time I use SHELLEX.TPL -Template from SterlingData - easy

What sort of “OPEN” do you have in mind?

If you mean OPEN a file inside of clarion?
then Use the DOS driver

If you mean
OPEN like double clicking on it in windows explorer
use ShellExcecute as Piet suggested

1 Like

I was referring to just opening a file (like a Word document) saved on local or network.

I was able to figure it out by using a CapeSoft HyperActive Control. It was super easy.

Thanks.

If you’re using a later release of Clarion then the RUN command will open any file with the application that’s associated with the file extension, so

RUN(‘c:\yourFolder\yourFile.DOCX’,1)

will open yourFile.DOCX with (by default) Word

2 Likes

Good to know. Thanks.

Thanks PBOUMA ii is now 4 jrs later and it still help people.
I battled with this specific uissue and got your download link.
Thanks a lot , make life so much easy.

You can call the Windows API function FindExecutableA() to check if there is a program registered to handle the File Extension for Open so you can show a nice message. Shell Execute will return the same No Association error.

I would not call RUN with (,1) to wait on something like a Word document that would cause your program to go Not Responding.

1 Like

In my case using RUN with (,1) with a file ext which is not associated to a program, a windows dialog will be shown (fast) to choose a program for association. Not a bad idea i suppose