Archive for the ‘MAPI’ Category

Strange problem on Vista’s Windows Mail

March 11, 2007

Our product contains an ActiveX that is used to create a mail message so the users can easily send custom data from our application.

Our code uses Simple MAPI’s MAPISendMail function to create the message. When it initialize the MapiMessage parameter we always pass the same arrays for the lpRecips and lpFiles members, but only if we need to pass actual recipients or files we initialize them. If not, they are not initialized, but this does not have to be a problem, since we pass 0 in the nRecipCount and nFileCount members.

And, indeed, there was never a problem with it, until our QA started testing our product on Windows Vista and found out that e-mail messages are not created when there are no attachments.

I checked it and found out that MAPISendMail returned MAPI_E_FAILURE which is a general error code with no real explanation. Playing with it some more I realized that the function, for some reason, looks into the lpFiles array, even though the nFileCount member is 0.

The fix was quite simple – pass a null pointer when nFileCount is 0, but this seems like a plain bug.

BTW, although I don’t plan to install Vista in the near future after what I’ve heard about it, I was really impressed with some of the small UI improvements in Vista’s File Explorer, and might give it a second thought in the not-so-near future.