Information générale
Catégorie:
COM/DCOM et OLE Automation
Hi Andrew,
thank you for your detailed answer - yes, in this case it works. But my problem is that I want use not only ApplicationEvents from Outlook which contains few events, but I need catch events from ItemsEvents interface (for example ItemChange event).
Here is my code, but it don't work:
#DEFINE olFolderTasks 13
* instance outlook and get handle to the task folder's items collection object.
loOutlook = CREATEOBJECT("Outlook.Application")
loNameSpace = loOutlook.GetNamespace("MAPI")
loTask= loNameSpace.GetDefaultFolder(13)
loItem = loTask.Items
* instance event handler.
loEvents = CREATEOBJECT("myclass")
* bind event handler to outlook items events.
? EVENTHANDLER(loItem,loEvents)
* add escape hatch: press F12 to stop read events.
ON KEY LABEL f12 CLEAR EVENTS
* see you later - asleep and processing events until F12 is pressed
READ EVENTS
* unbind eventhandler.
? EVENTHANDLER( loItem, loEvents, .T. )
* remove objects.
RELEASE loItem, loTask, loNameSpace,loOutlook
** class definitions **
DEFINE CLASS myclass AS SESSION OLEPUBLIC
IMPLEMENTS ItemsEvents IN "Outlook.Application"
PROCEDURE ItemsEvents_ItemAdd(ITEM AS VARIANT) AS VOID
* add user code here
DEBUGOUT PROGRAM()
DEBUGOUT ITEM.subject
ENDPROC
PROCEDURE ItemsEvents_ItemChange(ITEM AS VARIANT) AS VOID
* add user code here
DEBUGOUT PROGRAM()
DEBUGOUT ITEM.body
ENDPROC
PROCEDURE ItemsEvents_ItemRemove() AS VOID
* add user code here
DEBUGOUT PROGRAM()
ENDPROC
ENDDEFINE
I would be grateful for your trying my code.
Thanks in advance
Norbert
PS: Sorry for my English...
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement