Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to KEEP reading events?
Message
From
12/12/2003 04:05:38
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00858174
Message ID:
00858493
Views:
18
>I have a little program that I wrote to emulate (for Outlook 2002) the way that Outlook 2003 pops up a message window when a new email arrives.
>
>Everything works, except that after the first message is displayed, the program ends ... like it thinks it's done reading events. The only clear events I have is in the IconDblClickEvent of the Systray object.
>
>Any ideas? Do I need to put a do ... while loop around the read events command that says something like: do while type(loSysTray.TipText)=="C"? If so, I'm still curious as to why READ EVENTS stops "reading". Thanks for any advice!
>
>Here is the code:
>
>
>LOCAL loSysTray as Object, loObj as Object, loEvents as Object
>
>* MySysTray is class defined as systray of systray.vcx
>loSysTray = CREATEOBJECT("mySysTray")
>
>IF !TYPE("loSysTray.TipText") == "U"
>   loObj = CREATEOBJECT("Outlook.Application")
>   loEvents = CREATEOBJECT("OAEvents")
>
>   EVENTHANDLER(loObj,loEvents)
>
>   READ events
>
>   RELEASE loSysTray
>   RELEASE oEvents
>ENDIF
>
>RETURN
>
>DEFINE CLASS OAEvents AS session OLEPUBLIC
>
>   IMPLEMENTS ApplicationEvents_10 IN "c:\progra~1\micros~2\office10\msoutl.olb"
>
>   PROCEDURE ApplicationEvents_10_NewMail() AS VOID
>   * add user code here
>      oApp = CREATEOBJECT("Outlook.Application")
>      IF oApp.Explorers.Count > 0
>         oSafeItem = CREATEOBJECT("Redemption.SafeMailItem")
>         oFolder = oApp.explorers.item(1).CurrentFolder
>         oSafeItem.Item = oFolder.Items(1)
>         DO FORM c:\foxtemp\newmail WITH oSafeItem.SenderName, oSafeItem.Subject
>         RELEASE oApp
>         RELEASE oSafeItem
>         RELEASE oFolder
>      ENDIF
>   ENDPROC
>ENDDEFINE
>
This is a SWAG, but maybe you could experiment with DOEVENTS, since you're working with Outlook and not just VFP.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform