如何在自定义 API 上使用此函数

How to use this Function on a custom API

本文关键字:函数 API 自定义      更新时间:2023-10-16

我在使用API时遇到了问题,该API的功能是发送邮件,但问题是邮件的正文正在使用LPCVOID,我不知道如何使用它。我有谷歌搜索,没有关于如何使用它的明确解释。

这是整个函数:

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

参数:

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

我希望你能启发我,如果你有例子,我将不胜感激。

正如评论中已经提到的LPCVOIDconst void * 的类型定义。因此,您可以将任何指针传递给该函数。以下是示例:

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

std::wstring

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