Getting mail header with Delphi XE

Add-in Express™ Support Service
That's what is more important than anything else

Getting mail header with Delphi XE
 
Joel Milne




Posts: 1
Joined: 2010-10-31
Hello.

Newbie here. I've implemented the sample code to get the email header, however I am only getting back the first character of the header. I am guessing this is an issue with Delphi XE using Unicode strings. I've tried changing "s" to AnsiString rather than string but still get the same result. Any ideas how to make this work under Delphi XE?

if HrGetOneProp(IMessage, PR_TRANSPORT_MESSAGE_HEADERS, PropValue) = S_OK then
s := PropValue^.Value.lpszA;

Thanks!

****************************
Update: By changing "s" to a WideString and the code as follows, it now works. Although I'm wondering why lpszA is returning a PWideChar instead of PAnsiChar as it is defined.

if HrGetOneProp(IMessage, PR_TRANSPORT_MESSAGE_HEADERS, PropValue) = S_OK then
s := PWideChar(PropValue^.Value.lpszA);
Posted 31 Oct, 2010 04:33:17 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hi Joel,

Joel Milne wrote:
Although I'm wondering why lpszA is returning a PWideChar instead of PAnsiChar as it is defined.


As far as I remember, those properties of PropValue point to the same location in the memory.


Andrei Smolin
Add-in Express Team Leader
Posted 01 Nov, 2010 05:58:54 Top