Search Results

Search found 3 results on 1 pages for 'usfree74'.

Page 1/1 | 1 

  • Help! How to get the event handler with IE Dom interfaces?

    - by usfree74
    Hey Gurus, I am working to use IE Dom interface to automate IE page access. I am trying to get all event handlers defined in a page. I am using IHTMLElement object now for this purpose. If the html page defines "onclick=xxx", element.onclick returns the click handler. However, if an event handler is defined in javascript, element.onclick simply returns NULL. What's the right way to get the event handler then? Thanks, xin Below is an example that uses javascript to define event handler. $(document).ready(function(){ $("a").click(function(event){ $(this).hide("slow"); alert("Thanks for visiting!"); window.location="http://cnn.com"; }); }); jQuery

    Read the article

  • question about python COM programming

    - by usfree74
    Hey, I am trying to get the Dispatch object of IHTMLDocument3, so I wrote the following code wo = pythoncom.New('InternetExplorer.Application') wo.QueryInterface('{3050F673-98B5-11CF-BB82-00AA00BDCE0B}') But got the following error: pywintypes.com_error: (-2147467262, 'No such interface supported', None, None) Any idea on how to address this problem? Thanks, xin

    Read the article

  • c++-to-python swig caused memory leak! Related to Py_BuildValue and SWIG_NewPointerObj

    - by usfree74
    Hey gurus, I have the following Swig code that caused memory leak. PyObject* FindBestMatch(const Bar& fp) { Foo* ptr(new Foo()); float match; // call a function to fill the foo pointer return Py_BuildValue( "(fO)", match, SWIG_NewPointerObj(ptr, SWIGTYPE_p_Foo, 0 /* own */)); } I figured that ptr is not freed properly. So I did the following: PyObject* FindBestMatch(const Bar& fp) { Foo* ptr(new Foo()); float match; // call a function to fill the foo pointer *PyObject *o = SWIG_NewPointerObj(ptr, SWIGTYPE_p_Foo, 1 /* own */);* <------- 1 means pass the ownership to python PyObject *result = Py_BuildValue("(fO)", match, o); Py_XDECREF(o); return result; } But I am not very sure whether this will cause memory corruption. Here, Py_XDECREF(o) will decrease the ref count, which can free memory used by object "o". But o is part of the return value "result". Freeing "o" can cause data corrupt, I guess? I tried my change. It works fine and the caller (python code) does see the expected data. But this could be because nobody else overwrites to that memory area. So what's the right way to deal with memory management of the above code? I search the swig docs, but don't see very concrete description. Please help! Thanks, xin

    Read the article

1