batch 1999
batch 1999

Reputation: 109

How to use this Function on a custom API

I have encountered a problem using an API which function is to send Mail but the problem is that the body of the mail is using LPCVOID to which i have no idea how to use it. I have search google and there is no clear explanation on how to use it.

Here is the whole function:

IMTMail::Body(LPCVOID body,const UINT body_size)

Parameters:

body       [in] A pointer to the email body
body_size  [in] The size of the body in bytes

I hope you can enlighten me and if you have examples i will really appreciate it.

Upvotes: 2

Views: 97

Answers (1)

JustRufus
JustRufus

Reputation: 542

As already mentioned in comments LPCVOID is typedef of const void *. So you can pass any pointer to the function. And here are examples:

std::string body("Test Email Body!!!!!!!");
mail.Body( body.c_str(), body.size() ); //assume type of mail is IMTMail

with std::wstring

std::wstring body(L"Test Email Body!!!!!!!");
mail.Body( body.c_str(), body.size() ); //assume type of mail is IMTMail

Upvotes: 1

Related Questions