|
Instructions
This script reads in a structure name from an internal variable "VariableFlag" and adds an instance name to it. The variable value is then read from the final variable.
The following script is triggered by a mouse click on a button.
Program listing:
=============
#include "apdefap.h"
void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
char* InstanceNameA;
DWORD VarContA;
// Presetting of internal variable with structure name,
// this can also have happened at a different point
SetTagChar("VariableFlag","TriangleEnvelopeCurve");
// Reservation of memory
InstanceNameA = SysMalloc(200);
// Read in structure name
strcpy(InstanceNameA,GetTagChar("VariableFlag");
// Test output in diagnostic window
printf("Contents Pointer Position 1: %s\r\n", InstanceNameA);
// Add instance name to variable name
strcat(InstanceNameA,".Triangle_1");
// Test output in diagnostic window
printf("Contents Pointer Position 2: %s\r\n", InstanceNameA);
// Read in variable value
VarInhA = GetTagWord(InstanceNameA);
// Test output in diagnostic window
printf("VariableContents: %d\r\n", VarContA);
// Release of reserved memory
SysFree(InstanceNameA);
}
|