In
general, you should simply return the value of that variable. You didn't
include the next line of the makepy snippet which includes the types, but a
possibility is that the event handler is actually a function rather than a "sub"
- so maybe something like:
return
0, True
should
be used - returning 0 for the function itself, with the True being for
cancel.
Wish I
could be more help...
Mark
-----Original Message-----Hi all,
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of d tiu
Sent: Friday, 10 November 2006 7:15 AM
To: python-win32@python.org
Subject: [python-win32] OnItemSend cancel help
I'm writing an outlook addin, trying to stop email sends on certain
conditions. I'm using OnItemSend callbacks that has a cancel
parameter which if set to True, will cancel the send. It's not
working :(. I'm calling:
self.applicationEvents = DispatchWithEvents(application, ApplicationEvent)
with
class ApplicationEvent:
def OnItemSend(self, item, cancel):
print "OnItemSend"
cancel = True
and desperate, also tried:
class ApplicationEvent:
def OnItemSend(self, item, cancel):
print "OnItemSend"
cancel = True
return cancel
I've confirmed that the handler is getting called, but the cancel
parameter seems like it's not getting back to outlook.
The makepy has
# def OnItemSend(self, Item=defaultNamedNotOptArg,
Cancel=defaultNamedNotOptArg):
as the prototype on gen_py\ApplicationEvents.py.
Any ideas? One thing is that the VB call is
Sub object_ItemSend(ByVal Item As Object, Cancel As Boolean)
which I suspect Cancel is passed by reference? If so, is this handled
by the mechanisms in DispathWithEvents? If not, how does one do it?
Thanks
Dave
_______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32