[python-win32] Re: python crash with IE Activex
Mike Thompson
mike.spam.filter at day8.com.au
Wed Mar 16 11:56:27 CET 2005
Stani Michiels wrote:
>>
>>
>>Hi all,
>>I'm playing with the demo example ActiveXWrapper_IE.py. What I want is
>>avoid users access some url's. To accomplish this I'm using
>>OnBeforeNavigate2 event, returning a true value should cancel the request...
>>
>><code>
>>def OnBeforeNavigate2(self, pDisp, URL, Flags, TargetFrameName,
>>PostData, Headers, Cancel) :
>> self.log.write('OnBeforeNavigate2: %s\n' % URL)
>>
>> if URL == "http://www.microsoft.com/": <http://www.microsoft.com/%22:>
>> return 1
>></code>
>>
>>The problem is that if I return a true value, python crashes :s
>>
>>I've been searching some info, but got no luck :(
>>
>>Any ideas?
>>
>>Thanks
>>Xavi Beumala
>>
>
> I would like to know as well. Please let me know if you have a solution.
> Thanks,
> Stani
>
> http://spe.pycs.net
>
From memory ...
If you don't want to do the navigation:
Cancel = False
if you do, then leave Cancel as its default True
Perhaps code like this ...
-------------------------------------------------------------------
def OnBeforeNavigate2(self, pDisp, URL, Flags, TargetFrameName,
PostData, Headers, Cancel) :
self.log.write('OnBeforeNavigate2: %s\n' % URL)
if URL != "http://www.microsoft.com/":
Cancel = False
-------------------------------------------------------------------
--
Mike
More information about the Python-win32
mailing list