SetParameter

SetParameter sets environmental and security parameters for the script to run in, this give the calling code the ability to script known script with low securities or unknown script in a tighter security model.

typedef void (*pCallbackMethod)(
   CTScript* context,
   TVariable* inputList /*=NULL*/,
   unsigned short inputList_l /*=0*/,
   TVariable* outputList /*=NULL*/,
   unsigned short outputList_l /*=0*/,
   TVariable* errorVariable /*=NULL*/
);

unsigned int SetParameter(
   Parameter parameter,
   __int64 integer = 0,
   const char16_t *string = NULL,
   void **pointer = NULL
);

Parameters

parameteridentifer of the parameter.
integerinteger value.
stringconstant string value.
pointervoid pointer value that can include pCallbackMethod.

Return Values

If the method succeeds, the return value is zero else see error codes for more details.

Remarks

Example Use
  • C++
void callbackSystemReportEvent(
   CTScript* context,
   TVariable* inputList,
   unsigned short inputList_l,
   TVariable* outputList,
   unsigned short outputList_l,
   TVariable* errorVariable
) {
   CMyDialog *parent;
   MessageBox(context->GetParameter(CTScript::PARENT_CONTEXT,
                       NULL,NULL,(void**)&parent) == NO_ERROR
             ? parent->GetSafeHwnd() : NULL, 
             (const wchar_t*)inputList[0].WString(), 
             TEXT("Windows Event Log Error"),
             MB_ICONERROR);
   }
}

void CMyDialog::OnExecuteTScript()
{
   CTScript script();
   script.SetParameter(CTScript::PARENT_CONTEXT,0,NULL,this);
   script.SetParameter(CTScript::ADD_STATIC_CALLBACK_METHOD,0,
                    TEXT("System::ReportEvent(WString message, Integer level = 0)"),
                    callbackSystemReportEvent);
   script.SetParameter(CTScript::SOURCE_STRING,TEXT("
      main(){ System::ReportEvent("Hello World");}
   ");
   script.ExecuteStaticMethod();
}

Also See

ExecuteStaticMethod, GetParameter
Listen All
Comments (0)
Characters left: 2500
 

Contact Ekky

Thanks for your interest.

Ekky Software Customer Support Team.

Ekky Software Product Range
Ekky Software Homepage T-Accounts Online ObjectDatabase++ TScript Ekky Software Homepage T-Accounts Onlinee ObjectDatabase++ TScript