[python-win32] Getting HRESULT back from a com automation

Richard Bell rbell01824 at earthlink.net
Tue May 29 14:21:38 CEST 2007


Aside from the example I posted earlier, I adopted the approach you outlined
in your note, ie. I placed any exception results in class instance storage.
It looks like that will work although I've got a good deal more development
to do before being sure.

As to what codes I'm expecting ... heaven only knows.  I'm working with IE 7
now and it appears willing to return most anything under various boundary
conditions.  I'm in the process now of some systematic testing in an effort
to bring some kind of order to the affair.  


|-----Original Message-----
|From: Mark Hammond [mailto:mhammond at skippinet.com.au]
|Sent: Saturday, May 26, 2007 3:17 AM
|To: 'Richard Bell'; python-win32 at python.org
|Subject: RE: [python-win32] Getting HRESULT back from a com automation
|> I'm trying to get back the result of ie.Navigate().
|> According to the MSDN
|> documentation it should return a HRESULT.  It appears to
|> return None.  Is
|> there a way to get the return code from the com interaction?
|All error HRESULTs are returned via exceptions.  Unfortunately, there isn't
|a reliable way to get a success HRESULT - when it is known to be
|significant, functions often return them, and it sounds like we could also
|do that in your case (assuming it *always* returns None now).  It should
|also be possible to stick all HRESULTs in some thread-local-storage and
|fetchable via "GetLastHRESULT()" or similar.  What codes are you expecting
|to see?

More information about the Python-win32 mailing list