using JScript in my app 
Author Message
 using JScript in my app

Hey All !

I've just implemented all neccessary steps to use ActiveX scripting in my
app.
And I got a problem - in case of JScript something goes not that well.
Check this tiny func in JScript text file:

function on_CONNECT( msg )
{
 Panel.Trace( "on_CONNECT (" + msg.Body + ")\n" );
 return 0;

Quote:
}

msg = is the object (derived from CCmdTarget) which implemets some
properties & members via dispatch.
when calling function from JScript source, im passing IDispatch interface of
"msg" object into script:

 VARIANT result; VARIANTARG arg; arg.vt = VT_DISPATCH; arg.pdispVal =
lpDispatch;
 DISPPARAMS params = { &arg, NULL, 1, 0 };

m_dd.m_lpDispatch->Invoke( disp,
           IID_NULL,
           LOCALE_USER_DEFAULT,
           DISPATCH_METHOD,
           &params,
           &result,
           NULL,
           NULL
           ) ;

All is going just fine - function executes, etc. BUT, after returning back
to my app I've found that m_dwRef member of msg object is increased by one !
Seems like JScript were holding some interface of msg object inside... This
lead me to GPF, couse msg object is temporary (on stack)...

And, this does not happens when using VBScript engine, only when using
JScript !!!
Here is the same code for VBscript which works just fine :

Function on_CONNECT( ByVal msg )
 call Panel.Trace( "on_CONNECT (" & msg.Body & ")" & NL )
End Function

What should I do ? Is there any tip about function declaration in JScript
which helps me here ? Can't find it on MS sites
(MSDN etc)

Yury Zenkevich,
STAC Estonia.



Sat, 19 May 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. JScript source included in BOTH client and server apps

2. New-wave Apps in JScript/DHTML?

3. Overrriding JScript (or any Script) in MFC App Hosting WebBrowser Control

4. IE.App eventing with Jscript

5. Overrriding JScript (or any Script) in MFC App Hosting WebBrowser Control

6. Full-blown office app scripted with JScript?

7. Hosting JScript in a Dot Net App

8. JScript/ASP/MS Access App Error

9. launch an app using file returned from cgi

10. Problem using ScriptControl from non-MFC C++ app

11. convert vb app to be used on inernet

12. Using WSH to execute External App via IIS

 

 
Powered by phpBB® Forum Software