Calling a Script Function from C# WebBrowser App?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bill

    #1

    Calling a Script Function from C# WebBrowser App?

    Hello,

    I'm trying to figure out how to call a script function
    from a C# WebBrowser application analogous to the method
    described in the article "HOWTO: Call a Script Function
    from a VC WebBrowser Application". Can someone help here?

    I am able to invoke a function from the DocumentComplet e
    event using the "execScript " method of the IHTMLWindow2
    interface I retreved from the HTML document "Script"
    object. This works but does not give me the control I
    need to create a robust application that can gracefully
    handle the absence of a function. If a function doesn't
    exist on a specific page and the code blindly tries to
    invoke it with "execScript " an error is visible to the
    user and this is confusing to the end user. The app user
    should not know anything about a missing method/script
    error. I need to be able to signal a meaningful error
    message.

    I want to lookup IF a method exists and then if it does,
    invoke it and retrieve results (if any). I also want to
    be able to avoid invoking a method IF it DOES NOT exist.
    This is the reason I need more control than "execSctipt "
    gives me.

    Thanks in advance,

    - Bill

Working...