Using ScriptControl in C++/.NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I'm trying to use the MS ScriptControl in a C++/.NET application. However the Run() method that normally receives a string (function name) and a SAFEARRAY, is imported as System::Object __gc* Run( System::String __gc*, System::Object __gc*(__gc*) __gc[] )

How do I create and feed an array of System::Object __gc[] ??

Thanks
 
Solved!!

this->axScriptControl1->Language = S"VBScript"
this->axScriptControl1->Reset()
this->axScriptControl1->AddCode(S"Sub Main(arg1)\nMsgBox \"Hello there!, the arg was \" & arg1\nEnd Sub")
Object* myArray __gc[] = { __box(1234) }
this->axScriptControl1->Run(S"Main", &myArray)

When the VBScript is executed, the MSScriptControl shows a MsgBox that says: "Hello there!, the arg was 1234" :0

Now, does .NET objects implements IDispatch.... to use AddObject(name, object)? Let's see..

funny all that __gc / __box() stuff...
 
Back
Top