The apwpost.pas file

This example will repeat the Add and UCase functions, with the difference that instead of passing and returning variables, we will modify them by changing them inside Authorware.

Start a new Delphi project, and set it to create a dll (as demonstrated in the first example). Save the project as Setvar.dpr

Select File/New Unit. Save this file as apwpost.pas.

Add this code after the interface keyword..

uses
	WinTypes, WinProcs, sysutils;

{$ifndef WIN32}
Type
    	UINT = Word;
    	DWORD = LongInt;
	WPARAM = Word;
	LPARAM = LongInt;
{$endif}

Const SV_DONTCREATE = 0;
Const SV_CREATE = 1;
Const APW_STR_TYPE = 0;
Const APW_LONG_TYPE = 1;
Const APW_REAL_TYPE = 2;
Const APW_ANY_TYPE = 3;
Const APWC_GETVAR = 24587;
Const APWC_SETVAR = 24588;
Const EXPR_OK = 0;

type EV_VALUE = (string_value, real_value, long_value, string_ptr);

type APWC_EVALPB = {$ifdef WIN32} packed {$endif} record
	ev_type: Integer;
	case EV_VALUE of
		string_value: (string_value: THandle) ;
		real_value: (real_value: Double);
		long_value: (long_value : LongInt);
		string_ptr: (string_ptr: PChar);
	end;

type APWC_EVALPB_PTR = ^APWC_EVALPB;

type APWC_VARPB = {$ifdef WIN32} packed {$endif} record
	var_name: PChar;
	at_icon_name: PChar;
	at_icon_id: LongInt;
	flags: UINT;
	eval: APWC_EVALPB;
	end;

type APWC_VARPB_PTR = ^APWC_VARPB;

This code is a translation of the apwpost.h C header file. Note that this is not a complete translation, just the parts that are need to get and set variables.

The APWC_VARPB record is the one that is sent to Authorware. To use this record, you need to set the var_name field to the name of the variable you want to get the value of. The value of the variable is returned in the eval field. There is a more detailed discussion of these matters in the UCD developers information from Macromedia.

On to: The GetApwNumber function

Back to: Some background information       Start