<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TScriptControl - Werte an Funktionen übergeben]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe hoffentlich ein kleines Problem. Ich möchte an ein VBS-Programm Parameter übergeben. Das Problem ist nun, das die Parameter nicht richtig an das VBS-Programm übergeben werden, zurückgegeben wird aber ein Wert.</p>
<p>Hoffe Ihr könnt mir weiterhelfen.</p>
<pre><code class="language-cpp">Variant rueck;
LPSAFEARRAY psa;
SAFEARRAYBOUND rgsabound[1];

rgsabound[0].cElements = 2;
rgsabound[0].lLbound = 0;

psa = SafeArrayCreate(VT_VARIANT , 1, rgsabound);

long n=0;
SafeArrayPutElement(psa,&amp;n,SysAllocString(OLESTR(&quot;Test1&quot;)));
n++;
SafeArrayPutElement(psa,&amp;n,SysAllocString(OLESTR(&quot;Test2&quot;)));

ScriptControl1-&gt;AddCode(L&quot;Function Test(Text1,Text2)\nMsgBox \&quot;Text \&quot; &amp; Text1\nTest=\&quot;Rückantwort\&quot;\nEnd Function&quot;);
rueck= ScriptControl1-&gt;Run(L&quot;Test&quot;,&amp;psa);

AnsiString ruecktext= rueck.operator AnsiString();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/172867/tscriptcontrol-werte-an-funktionen-übergeben</link><generator>RSS for Node</generator><lastBuildDate>Fri, 14 Aug 2026 13:18:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/172867.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Feb 2007 08:40:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TScriptControl - Werte an Funktionen übergeben on Sat, 10 Feb 2007 08:01:13 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe hoffentlich ein kleines Problem. Ich möchte an ein VBS-Programm Parameter übergeben. Das Problem ist nun, das die Parameter nicht richtig an das VBS-Programm übergeben werden, zurückgegeben wird aber ein Wert.</p>
<p>Hoffe Ihr könnt mir weiterhelfen.</p>
<pre><code class="language-cpp">Variant rueck;
LPSAFEARRAY psa;
SAFEARRAYBOUND rgsabound[1];

rgsabound[0].cElements = 2;
rgsabound[0].lLbound = 0;

psa = SafeArrayCreate(VT_VARIANT , 1, rgsabound);

long n=0;
SafeArrayPutElement(psa,&amp;n,SysAllocString(OLESTR(&quot;Test1&quot;)));
n++;
SafeArrayPutElement(psa,&amp;n,SysAllocString(OLESTR(&quot;Test2&quot;)));

ScriptControl1-&gt;AddCode(L&quot;Function Test(Text1,Text2)\nMsgBox \&quot;Text \&quot; &amp; Text1\nTest=\&quot;Rückantwort\&quot;\nEnd Function&quot;);
rueck= ScriptControl1-&gt;Run(L&quot;Test&quot;,&amp;psa);

AnsiString ruecktext= rueck.operator AnsiString();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1225482</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1225482</guid><dc:creator><![CDATA[Foley]]></dc:creator><pubDate>Sat, 10 Feb 2007 08:01:13 GMT</pubDate></item><item><title><![CDATA[Reply to TScriptControl - Werte an Funktionen übergeben on Mon, 12 Feb 2007 14:12:30 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>so jetzt habe ich die Lösung gefunden.</p>
<pre><code class="language-cpp">Variant rueck;
    Variant in[2];
    LPSAFEARRAY psa;
    SAFEARRAYBOUND rgsabound[] = {2,0};

    psa = SafeArrayCreate(VT_VARIANT , 1, rgsabound);

    if ( !psa ) return ;

    Variant help1 = &quot;1000&quot;;
    Variant help2 = &quot;2000&quot;;
    in[0] = Variant(SysAllocString(help1));
    in[1] = Variant(SysAllocString(help2));

    long n=0;
    SafeArrayPutElement(psa,&amp;n,&amp;in[0]);
    n++;
    SafeArrayPutElement(psa,&amp;n,&amp;in[1]);

    ScriptControl1-&gt;Language = &quot;VBScript&quot;;
    ScriptControl1-&gt;AddCode(L&quot;Function Test(Text1,Text2)\nMsgBox \&quot;Text \&quot; &amp; Text1*Text2\nTest=Text1*Text2\nEnd Function&quot;);
    //ScriptControl1-&gt;Language = &quot;JScript&quot;;
    //ScriptControl1-&gt;AddCode(L&quot;function Test(Text1,Text2)\n{return Text2+Text1;}&quot;);
    rueck= ScriptControl1-&gt;Run(L&quot;Test&quot;,&amp;psa);

    AnsiString ruecktext= rueck.operator AnsiString();

    SafeArrayDestroy(psa);
    CoUninitialize();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1227418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1227418</guid><dc:creator><![CDATA[Foley]]></dc:creator><pubDate>Mon, 12 Feb 2007 14:12:30 GMT</pubDate></item></channel></rss>