Saturday, May 24, 2003

Authorware and WinAPI are there any references? Part 2


7. Double-click the file WinAPI.u32. A dialogue opens entitled em<>Custom functions in WinAPI.u32.
8. A brief browse of this dialogue reveals hundreds of functions that are available to you from Authorware.
9. For now we are interested only in CopyFile, so scroll down to it and, for now, select it with a single click of your mouse.

This is where things stop being completely simple. Notice what the Description filed says :-

BOOL = CopyFile( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists )
Windows API Call See Windows SDK for description.


First, the parameters? What is that all about? Well as Authorware developers, all we need to know is that it translates to:-

success:=CopyFile(From, To, Overwrite?)

From would be the file you are copying, e.g.
FileLocation^"TestCopy.txt"

To would be the file you copy to, e.g.
RecordsLocation^"CopiedFile.txt"

Overwrite? is 1 if you want to overwrite the file if it already exists, and 0 if you don't want to overwrite.

So where is this Windows SDK that we are supposed to reference? Sadly not on your Authorware CD. You need to go to Microsoft for that. If you already do Windows development with, say C++ or Delphi you may already have an appropriate Windows API reference. If not, you need to go to MSDN. However the reference there is all aimed at C programmers. Take, for instance, the CopyFile() reference.

Fortunately there is a nice reference designed for Authorware - the Authorware Win API Guide. This site documents around 70 WinAPI functions with example code and files.

Important notes
Many WinAPI functions are not suitable for use with Authorware because they require variable types not available with Authorware, or the require advanced memory manipulation.

It appears some functions do not work with Windows XP. If in doubt, check with the Aware List, there are several people there who can answer specific questions about using WinAPI.

No comments: