Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapi email problem in 64 bit Windows 7 1

Status
Not open for further replies.

steve3739

Programmer
Jul 5, 2002
32
US
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:
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()
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):
Code:
lSession = createobject("MSMAPI.MAPISession")
lSession.Signon()
lSession.Signoff()
I have spent several days searching for a solution before posting here. Any help would be greatly appreciated.

Thanks
 
If you have the error in win7 64bit and Mike Gagnon does not have it in win7, then it's either that difference, or Mike also has installed some software including the mapi 32bit class.

What you can always try is to set your applications properties to run in some compatibility mode. It will always run in 32bit anyway, also on 64bit win7, but that compatibility might change how it looks for ole classes.

Googling win7 mapi I found there is a hotfix für mapi on win7 x64, so this may help you:



Bye, Olaf.
 
Thanks to both of you. Before I try the Hotfix suggested by Olaf, I am curious regarding the details of the mapi32.dll on Mike's system. (I have 2 mapi32.dll's)

My System32 folder has a mapi32.dll with the following details:
Size: 91,648 bytes, on disk 94,208
File Ver: 1.0.2536.0, Product Ver: 6.1.7601.17514
Date: 11/20/2010 7:23 PM

My SysWOW64 folder has a mapi32.dll with the following details:
Size: 76,800 bytes, on disk 77,824
File Ver: 1.0.2536.0, Product Ver: 6.1.7601.17514
Date: 11/20/2010 7:24 PM

It looks like the only difference between the two is the file size.

Also, I am running VFP in XP compatibility mode.

P.S. I had thought of temporarily renaming the system32 mapi32 and then replacing it with the mapi32.dll from my old XP. However, Windows won't let me rename the mapi32.dll file, telling me that I need permission from "TrustedInstaller".

Thanks again,
Steve
 
Well, yes you don't fiddle with system files that way, renaming them. And you would need to care about the SysWOW64 folder, not system32.

It's a good idea to compare versions with Mike Gagnon, besides that your version already is newer than 6.1.7600.20652 from 24-Feb-2010.

So perhaps switch to something else. For base techniques working without any specific mail client you still can choose SMTP or CDOMail. They just expect you to know smpt server and login credentials, whcih you might interactively ask from the user.

Bye, Olaf.

 
Just to follow up... I'm reluctant to run that HotFix Olaf linked to, as it's an earlier version that what is currently installed. I'll take a look at SMTP or CDOMail, but for the time being, I'll just leave things as they are and disable that one function, rather than risk making the situation worse.

Thanks for your help and feedback.
Steve
 
Finally solved as follows: Made Windows Live Mail the default mail program in both "Set your default programs" and "Set program access and computer defaults / custom." Then went back and changed both settings to Mozilla Thunderbird, my email client. VFP50 now composes a Thunderbird email using MSMapi with no error. (However, I don't know if this solution would work for other email clients.)
 
Ok, if that rpocedure helps. Seems like choosing Windows Mail does something, but you'll never know if only doing the second step would also be sufficient. Of course some (mapi compliant) mail program has to be set as a default, otherwise MAPI will not know what to use.

Browser more prominently ask, if you wish to set them as the default browsers, mail programs do not so.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top