Entry
- Authorware plugin format.
Friends who have used Authorware may notice that there are more than a dozen extensions .u32 or .ucd files in the Authorware system directory, it is true, this is the authorware plugin. In fact, the format of these files is a very standard Window dynamic link library file, which is * .dll such a file. Authorware passed the specified function in the dynamic link library file, if the function requires parameters, Authorware passed all parameters of the function accessed by the file, if the function has a return value, then Authorware gives the return value of the function. However, the problem is: Authorware calls these functions and does not know the parameters or return values of the function, even if the external function is called in the Viusal Basic, the expression, parameters, and return values of the function are required. Let's take a step by step to unveil the mystery of Authorware plugin.
Mystery of the two string resources.
I think we'd better explain how Authorware is implemented by an example. Suppose we need to implement such a feature in Authorware now: We have developed a multimedia courseware or other demo software with Authorware, and don't want others to secretly run this program. You need to use a password input box to limit it, and Authorware does not provide the corresponding Function, now we use DEPHI to implement this feature. Now we need to create a function to call the input box, the function prototype is as follows:
DisplayInputBox (Caption, Information, Defaulttxt: Pchar): PCHAR;
Here we need to pass three parameters: CAPTION: Enter box title
Information: Tips
Defaulttxt: Default text
Return Value: The text of the user's final input.
Because here is a written DLL function, the string type can only be used with PCHAR, instead of the String type of DEPHI, because the external program is used to use the C-compatible string with a zero character ending. The Authorware plug-in is different from the ordinary DLL file: it has a string resource. Take the above function, the format of the string is as follows: (notes in parentheses, do not join)
1 DLL_HEADER LOADONCALL Discardable (Function Prototype Declaration)
Begin
"DisplayInputbox / 0", ("/ 0" for authorware identification, the same below)
"/ 0"
End
DisplayInputBox DLL_HEADER LOADONCALL DISCARDABLE (Function Parameters and Return Value Description)
Begin
"/ 0", (Renewal)
"S / 0", (first for the return value description, "S / 0" indicates the return value of the string type)
"SSS / 0", (note that the three s indicate the parameter of three string types);
"Result = DispinputBox (CAPTION, TIPTXT, DEFAULTTXT) / R / N" (function call instructions, mainly introducing the function usage, which finally appears in the Authorware Call function description box)
"/ r / n" (here is empty)
"Function: display the entry box of: Wuhan Xu Jin Wu Luo Road Middle School / 0" (adding copyright information, ibid.) END
Ok, now I understand, the secret of the Authorware identifies the format of the function format is in this string resource list. Also I want to explain that if the parameter or return value is Integer (integer variable), it is represented as "I / 0". If the long (long integer variable) is "l / 0". Let's work below. Things is to quickly enter the above string resources and save, we named WRESOURCE.RC in a text editor (notepad). Find the bin directory under the DEPHI system, compile the file into resource file awresource.resource with the brcc32.exe file. The method is to enter the command line "brcc32.exe awresource.rc" in the Start menu. Save the generated resource file to the DEPHI project file directory that we want to start immediately, we can start writing Authorware plugins using Dephi.