I am trying to get this function:
DllExport HRESULT WINAPI readrtf (LPSTR lpProfileName, LPSTR lpMsgIDSrc, LPSTR lpStoreIDSrc, LPSTR *lpRTF)
to run from my C# code. I am using this statement:
[DllImport("mapirtf.dll"]
private static extern int readrtf (string ProfileName, string SrcMsgID, string SrcStoreID, [MarshalAs(UnmanagedType.LPStr)] ref StringBuilder MsgRTF);
to import the function. I then try to access it as such:
StringBuilder ans = new StringBuilder(100);
readrtf((string) ((MAPI.Session) my_message.Session).Name, (string) my_message.ID, (string) my_message.StoreID, ref ans)
return ans.ToString();
But the return value is empty. I have tried not using ref on the StringBuilder but I get an error saying that an object reference has not been set. Any ideas on how to properly marshal the StringBuilder in this case?
"Programming is like sex, one mistake and you have to support it forever."
John
johnmc@mvmills.com
DllExport HRESULT WINAPI readrtf (LPSTR lpProfileName, LPSTR lpMsgIDSrc, LPSTR lpStoreIDSrc, LPSTR *lpRTF)
to run from my C# code. I am using this statement:
[DllImport("mapirtf.dll"]
private static extern int readrtf (string ProfileName, string SrcMsgID, string SrcStoreID, [MarshalAs(UnmanagedType.LPStr)] ref StringBuilder MsgRTF);
to import the function. I then try to access it as such:
StringBuilder ans = new StringBuilder(100);
readrtf((string) ((MAPI.Session) my_message.Session).Name, (string) my_message.ID, (string) my_message.StoreID, ref ans)
return ans.ToString();
But the return value is empty. I have tried not using ref on the StringBuilder but I get an error saying that an object reference has not been set. Any ideas on how to properly marshal the StringBuilder in this case?
"Programming is like sex, one mistake and you have to support it forever."
John
johnmc@mvmills.com