I have a Purchase Order application, written in VFP50, that allows a user to automatically generate an email, using their default email client, to send to a vendor. This is the code that creates the email:
This has worked for many years with no problem under Windows XP. I recently moved the application to a new Windows 7 64-bit machine. The application runs fine except for this one part which produces an unspecified Windows error and terminates VFP. The Signoff() command appears to be the culprit. I can type the following three commands into the VFP command window, and watch the signoff() command cause the problem (there is NO error under XP):
I have spent several days searching for a solution before posting here. Any help would be greatly appreciated.
Thanks
Code:
local lSession,lMessages
lSession = createobject("MSMAPI.MAPISession")
lSession.Signon()
if (lSession.SessionID >0)
lMessages = createobject("MSMAPI.MAPIMessages")
lMessages.SessionID=lSession.SessionID
endif
with lMessages
.Compose()
if len(csupemail)>0
.RecipIndex=1
.RecipAddress=csupemail
.RecipType=1
endif
.RecipIndex=2
.RecipAddress='xxxxxxxxx@xxxxxx.com'
.RecipType=3
.AttachmentPathName=attachfile
.MsgSubject="Purchase Order "+trim(csearch)
.MsgNoteText=cmessage
.Send(.T.)
endwith
lSession.Signoff()
Code:
lSession = createobject("MSMAPI.MAPISession")
lSession.Signon()
lSession.Signoff()
Thanks