Announcement

Collapse
No announcement yet.

EVENTS END Crashes

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

  • Thomas Tierney
    replied
    Thanks for responding David

    I just saw it after I sent an email to support...

    Leave a comment:


  • David Warner
    replied
    Hi Thomas,

    you just pipped me to the post! I was going to say...

    try changing

    Code:
    EVENTS END oScript
    to

    Code:
    EVENTS END gEvent

    David

    Leave a comment:


  • Thomas Tierney
    replied
    Never mind... was ending the wrong object

    Leave a comment:


  • Thomas Tierney
    started a topic EVENTS END Crashes

    EVENTS END Crashes

    Hey all,

    I have the following code that creates a script object and a script event handler.

    When the Code hits the Events End it crashes, does anyone know why?
    Is this properly defined?

    Thanks in advance..

    Code:
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "win32api.inc
    
    
    
    $CLSID_MSScriptControl_Event_DScriptControlSource = GUID$("{DE133AF7-F9DE-474B-BE2D-40F8F1F2EF5A}")
    $IID_MSScriptControl_DScriptControlSource = GUID$("{8B167D60-8605-11D0-ABCB-00A0C90FFFC0}")
    
    CLASS Class_DScriptControlSource $CLSID_MSScriptControl_Event_DScriptControlSource AS EVENT
        INTERFACE DScriptControlSource $IID_MSScriptControl_DScriptControlSource
            INHERIT IDISPATCH
            METHOD ERROR <3000> ()
                ' Insert your code here
                MSGBOX "ERROR IN EVENT"
            END METHOD
    
            METHOD TIMEOUT <3001> ()
                ' Insert your code here
                MSGBOX "TIMEOUT IN EVENT"
    
            END METHOD
    
        END INTERFACE
    END CLASS
    
    FUNCTION PBMAIN () AS LONG
        LOCAL gEvent    AS DScriptControlSource
        LOCAL vLang     AS VARIANT
        LOCAL vTimeOut  AS VARIANT
        LOCAL vAllowUI  AS VARIANT
        LOCAL vCode     AS VARIANT
        
        LOCAL oScript   AS DISPATCH
        
        
        LET gEvent = CLASS "Class_DScriptControlSource"
        SET oScript = NEW DISPATCH IN "MSScriptControl.ScriptControl.1"
        
        
        EVENTS FROM oScript CALL gEvent
    
        vLang = "vbscript"
        vTimeout = -1
        vAllowUi = %TRUE
    
        OBJECT LET oScript.Language = vLang
        OBJECT LET oScript.Timeout = vTimeOut
        OBJECT LET oScript.AllowUi = vAllowUI
    
        vCode = "Msgbox ""FOO"""
        OBJECT CALL oScript.AddCode(vCode)
        
        EVENTS END oScript
    
        SET oScript = NOTHING
        
    END FUNCTION
Working...
X