BodyPart Property
BodyPart Property
The BodyPart property specifies the IBodyPart interface on this object.
Syntax
Property BodyPart as IBodyPart
read-only
HRESULT get_BodyPart(IBodyPart** pVal);
Remarks
This property returns the IBodyPart interface on the object, and acts as a replacement for standard interface navigation mechanisms such as QueryInterface.
Example
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iMsg as New CDO.Message
Dim iBp as CDO.IBodyPart ' for IBodyPart on message
'Get IBodyPart using BodyPart property
Set iBp = iMsg.BodyPart
Set iBp = Nothing ' Release
' Get IBodyPart using QI
Set iBp = iMsg
Set iBp = Nothing ' Release
#include "cdosys.h"
#include "cdosys_i.c"
void main(){
CoInitialize(NULL);
IMessage* pMsg = NULL;
CoCreateInstance(CLSID_Message,
NULL,
CLSCTX_INPROC_SERVER,
IID_IMessage,
reinterpret_cast<void**>(&pMsg));
IBodyPart* pBp = NULL;
// Get IBodyPart using the property
pMsg->get_BodyPart(&Bp);
pBp->Release();
// Get IBodyPart using QI
pMsg->QueryInterface(IID_IBodyPart,
reinterpret_cast<void**>(&pBp));
pBp->Release();
pMsg->Release();
// ...
CoUninitialize();
}