Creating the resource file

The last thing we need to do is to add the UCD resource, so that APW can directly load the functions. To do this, we need to make up a .rc file, and then compile it into a .res file.

Start Notepad. This is what is used to create the resource file.

Add all this code; I will explain something about it afterwards.

1 DLL_HEADER PRELOAD DISCARDABLE
BEGIN
     "Add\0",
     "UCase\0",
     "\0"
END

Add DLL_HEADER PRELOAD DISCARDABLE
BEGIN
     "\0",
     "I\0",
     "II\0",
     "Result := Add( Num1, Num2 )\r\n",
     "\r\n",
     "Adds two numbers together\0",
END

UCase DLL_HEADER PRELOAD DISCARDABLE
BEGIN
     "\0",
     "S\0",
     "S\0",
     "Result := UCase( str )\r\n",
     "\r\n",
     "Returns the upper case version of str\0",
END

Some explanations:

1 DLL_HEADER PRELOAD DISCARDABLE
BEGIN
     "Add\0",
     "UCase\0",
     "\0"
END

This part describes the functions available. Add each new function on a new line. Each line has a "\0" at the end of it to indicate the end of the function name. The section ends with "\0" on a single line. It doesn't matter what order the functions are listed in.

UCase DLL_HEADER PRELOAD DISCARDABLE
BEGIN
     "\0",
     "S\0",
     "S\0",
     "Result := UCase( str )\r\n",
     "\r\n",
     "Returns the upper case version of str\0",
END

Each function will then be described in it's own section. Note that the functions can be listed in any order.

The section starts with a single line with "\0".

The next line lists the Return type.
Use S for string; I for integer; V for void. See the Using Authorware manual for a full list of possible types.

The next line lists the arguments.
If there is more than one argument, place them all together eg "SIIS\0",

What follows then is the description of the function. This will appear in the description box when you load the function. To break the description into lines, place "\r\n" at the end of the line. At the end of the last line of the description, add "\0".

Please note that the layout of this file is very strict - if you do not follow it correctly, then all sorts of strange things will happen when you try to load a function.

on to: Compiling the resource file

back to: Setting some project options          Start