Announcement

Collapse
No announcement yet.

msg for jose roca on IActiveScript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • msg for jose roca on IActiveScript

    Jose,

    I was at your site and saw some code there in regards to IActiveScript. Where did you generate the ActivScp.INC from?

    Thanks
    Sr. Software Development Engineer and Sr. Information Security Analyst,
    CEH, Digital Forensic Examiner

  • #2
    You can't generate it since there is no type library for it. You have to translate it by hand.

    The attached file contains ActivScp.h, the original C++ header.
    Attached Files
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      Jose,

      Thanks for the info, I found the IDL and modified it and generated a typelib from it. Once that was done it was some simple mods to get the code to work. One last question though, I need to signal the end of the script by creating a method called End on the myObject class. How do I signal the current ActiveScript that I am done and that it should exit?


      Thanks
      Sr. Software Development Engineer and Sr. Information Security Analyst,
      CEH, Digital Forensic Examiner

      Comment


      • #4
        Sorry, but I don't understand what you mean. When you call hr = pIActiveScript.SetScriptState(%SCRIPTSTATE_CONNECTED), the script will execute synchroniously. The next instruction in your program will be executed when the script will end.
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          hmm...

          Okay.. I have an object myScript, on that object is a method called End.. in the script I will have the line myScript.End at which point I need the script to end. I assume that in the method End I set some sort of signal or state to the IACTIVESCRIPT object that says.. "the script has ended" but not sure how to do it..
          Sr. Software Development Engineer and Sr. Information Security Analyst,
          CEH, Digital Forensic Examiner

          Comment


          • #6
            You can add a method to set a flag and call it from the script code, although I don't see the purpose, because the script will end when it ends, not when you say that has ended.
            Forum: http://www.jose.it-berater.org/smfforum/index.php

            Comment


            • #7
              Look at ASP, in the response object. It has a method called End

              for instance
              Response.Write "Foo"
              Response.End

              Resonse.End signals the asp engine that the script is done..

              I dont see anything different there
              Sr. Software Development Engineer and Sr. Information Security Analyst,
              CEH, Digital Forensic Examiner

              Comment


              • #8
                I don't know ASP.

                Add a method, e.g. "Finished", to the class:

                Code:
                CLASS CMyObject $IID_CMyObject
                
                   INTERFACE IMyObject $IID_IMyObject
                
                   INHERIT IDispatch
                
                   METHOD SayHi (BYVAL bstrTo AS STRING)
                      PRINT "Say Hi to " & ACODE$(bstrTo)
                   END METHOD
                
                   METHOD Sum (BYVAL a AS LONG, BYVAL b AS LONG)
                      PRINT STR$(a) & " +" STR$(b) & " =" & STR$(a + b) & ", isn't it?"
                   END METHOD
                
                   METHOD Finished
                      PRINT "Finished"
                   END METHOD
                
                   END INTERFACE
                
                END CLASS
                And call it from the script, e.g.

                Code:
                   wstrScript = "Sum 2,3" & $CRLF & _
                                "SayHi(" & $DQ & "Active Scripting" & $DQ & ")" & $CRLF & _
                                "Finished"
                Forum: http://www.jose.it-berater.org/smfforum/index.php

                Comment


                • #9
                  Thanks for all the help Jose...

                  I found it.. I need to call the method InterruptScriptThread in my object


                  Method Finished()

                  myActivSco.InterruptScriptThread(threadId, ei, 0)

                  End method

                  This will interrupt the thread and signal an error and a state change. Now the problem I have is the Exception Info.

                  Local ei As EXCEPINFO
                  ei.wCode = 0
                  ei.sCode = 0
                  ei.dwHelpContext = 210

                  When I pass this to the InterrupScriptThread method, IActiveScript is supposed to pass this directly to the OnScriptError event. No matter what I
                  do it returns 80004005, this means that it does not understand the EXCPEINFO that I am passing in

                  am I passing this in properly?

                  Definition of InterrupScriptThread
                  Method InterruptScriptThread(ByVal stidThread As Dword, ByRef In pexcepinfo As EXCEPINFO, ByVal dwFlags As Dword) As _
                  Long

                  Code:
                  Method End()
                      Local scrThreadId As Long
                      Local ei As EXCEPINFO
                  
                      ei.wCode = 0
                      ei.sCode = 0
                      ei.dwHelpContext = 210
                  
                      
                      pIActiveScript.GetCurrentScriptThreadID(scrThreadId)
                      pIActiveScript.InterruptScriptThread(scrThreadId, ei,  0)
                  
                     End Method
                  Sr. Software Development Engineer and Sr. Information Security Analyst,
                  CEH, Digital Forensic Examiner

                  Comment


                  • #10
                    got it, had to send in an wcode other than 0
                    Sr. Software Development Engineer and Sr. Information Security Analyst,
                    CEH, Digital Forensic Examiner

                    Comment

                    Working...
                    X