本文整理汇总了C++中COleClientItem::GetUserType方法的典型用法代码示例。如果您正苦于以下问题:C++ COleClientItem::GetUserType方法的具体用法?C++ COleClientItem::GetUserType怎么用?C++ COleClientItem::GetUserType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COleClientItem
的用法示例。
在下文中一共展示了COleClientItem::GetUserType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
STDMETHODIMP COlePropertiesDialog::XOleUIObjInfo::GetObjectInfo(
DWORD dwObject, DWORD* lpdwObjSize, LPTSTR* lplpszLabel,
LPTSTR* lplpszType, LPTSTR* lplpszShortType, LPTSTR* lplpszLocation)
{
COleClientItem* pItem = (COleClientItem*)dwObject;
ASSERT_VALID(pItem);
BOOL bIsLink = (pItem->GetType() == OT_LINK);
if (lpdwObjSize != NULL)
{
ASSERT(pItem->m_lpStorage != NULL);
// try ILockBytes first, then IStorage
STATSTG statStg;
if ((pItem->m_lpLockBytes == NULL ||
pItem->m_lpLockBytes->Stat(&statStg, STATFLAG_NONAME) != S_OK) &&
pItem->m_lpStorage->Stat(&statStg, STATFLAG_NONAME) != S_OK)
{
*lpdwObjSize = 0xFFFFFFFF;
}
else
{
ASSERT(statStg.pwcsName == NULL);
if (statStg.cbSize.HighPart > 0)
*lpdwObjSize = 0xFFFFFFFE;
else if (statStg.cbSize.LowPart == 0)
*lpdwObjSize = 0xFFFFFFFF;
else
*lpdwObjSize = statStg.cbSize.LowPart;
}
}
if (lplpszLabel != NULL)
{
TCHAR szFormatLink[128];
AfxLoadString(AFX_IDS_PASTELINKEDTYPE, szFormatLink, _countof(szFormatLink));
TCHAR szFormatObj[] = _T("%s");
LPTSTR lpszFormat = bIsLink ? szFormatLink : szFormatObj;
CString strType;
pItem->GetUserType(USERCLASSTYPE_FULL, strType);
CString strResult;
strResult.Format(lpszFormat, (LPCTSTR)strType);
*lplpszLabel = AfxAllocTaskString(strResult);
}
if (lplpszType != NULL)
{
LPOLESTR lpOleStr;
pItem->m_lpObject->GetUserType(USERCLASSTYPE_FULL, &lpOleStr);
*lplpszType = TASKSTRINGOLE2T(lpOleStr);
}
if (lplpszShortType != NULL)
{
LPOLESTR lpOleStr;
pItem->m_lpObject->GetUserType(USERCLASSTYPE_SHORT, &lpOleStr);
*lplpszShortType = TASKSTRINGOLE2T(lpOleStr);
}
if (lplpszLocation != NULL)
{
if (bIsLink)
{
LPOLELINK lpOleLink = NULL;
pItem->m_lpObject->QueryInterface(IID_IOleLink, (LPVOID*)&lpOleLink);
ASSERT(lpOleLink != NULL);
LPOLESTR lpOleStr;
lpOleLink->GetSourceDisplayName(&lpOleStr);
*lplpszLocation = TASKSTRINGOLE2T(lpOleStr);
lpOleLink->Release();
}
else
{
CDocument* pDoc = (CDocument*)pItem->GetDocument();
CString strLocation = pDoc->GetPathName();
if (strLocation.IsEmpty())
strLocation = pDoc->GetTitle();
*lplpszLocation = AfxAllocTaskString(strLocation);
}
}
return S_OK;
}