OpenFile

Description:

baOpenFile opens a document, using the program that the file is associated with.

Platforms:

Windows and Macintosh

Usage:

Result = baOpenFile( FileName , State )

Arguments:

String, string.
FileName is the name of the file to open. The full path name should be supplied.
State is the window state to open the file with.
On Windows, can be one of these:
    "Normal"shows in its usual state.
    "Hidden"is not visible.
    "Maximised"shows as a maximised window.
    "Minimised"shows as an minimised icon.
On Macintosh, State is ignored.

Returns:

Integer.
Returns an error code. If the return is less than 32 then an error occurred.
See Notes for details.

Examples:

Director:
OK = baOpenFile( the moviePath & "test.txt" , "maximised" )

Authorware:
OK := baOpenFile( FileLocation ^ "test.txt" , "maximised" )
 

Notes:

You should always use the full path to the file being opened. Windows will search for the file in limited specific places such as the current directory and the PATH variable, but Macintosh won't.

On Windows, possible errors include:
 

System was out of memory.

File was not found.

Path was not found.

Sharing or network-protection error.

Library required separate data segments for each task.

There was insufficient memory to start the application.

10 

Windows version was incorrect.

11 

Executable file was invalid. Either it was not a Windows application or there was an error in the .EXE image.

12 

Application was designed for a different operating system.

13 

Application was designed for MS-DOS 4.0.

14 

Type of executable file was unknown.

15 

Attempt was made to load a real-mode application (developed for an earlier version of Windows).

16 

Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read-only.

19 

Attempt was made to load a compressed executable file. The file must be decompressed before it can be loaded.

20

Dynamic-link library (DLL) file was invalid. One of the DLLs required to run this application was corrupt.

21 

Application requires 32-bit extensions.

26 

A sharing violation occurred.

27 

The filename association is incomplete or invalid.

29 

The DDE transaction failed.

30 

The DDE transaction could not be completed because other DDE transactions were being processed.

31 

There is no application associated with the given filename.

On Macintosh, an error will result in a return of 0.

To open a file in a program other than the default one, use baShell.


 

See also:

baPrintFile
baShell