本文整理汇总了C++中IRunningObjectTable类的典型用法代码示例。如果您正苦于以下问题:C++ IRunningObjectTable类的具体用法?C++ IRunningObjectTable怎么用?C++ IRunningObjectTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IRunningObjectTable类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddGraphToRot
// Adds a DirectShow filter graph to the Running Object Table,
// allowing GraphEdit to "spy" on a remote filter graph.
HRESULT AddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister)
{
IMoniker * pMoniker;
IRunningObjectTable *pROT;
WCHAR wsz[128];
HRESULT hr;
if (FAILED(GetRunningObjectTable(0, &pROT)))
return E_FAIL;
wsprintfW(wsz, L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph,
GetCurrentProcessId());
hr = CreateItemMoniker(L"!", wsz, &pMoniker);
if (SUCCEEDED(hr))
{
hr = pROT->Register(0, pUnkGraph, pMoniker, pdwRegister);
pMoniker->Release();
}
pROT->Release();
return hr;
}
示例2: AccessVisualStudioViaDTE
/** Accesses the correct visual studio instance if possible. */
EAccessVisualStudioResult AccessVisualStudioViaDTE(TComPtr<EnvDTE::_DTE>& OutDTE, const FString& InSolutionPath, const TArray<FVisualStudioSourceCodeAccessor::VisualStudioLocation>& InLocations)
{
EAccessVisualStudioResult AccessResult = EAccessVisualStudioResult::VSInstanceIsNotOpen;
// Open the Running Object Table (ROT)
IRunningObjectTable* RunningObjectTable;
if(SUCCEEDED(GetRunningObjectTable(0, &RunningObjectTable)) && RunningObjectTable)
{
IEnumMoniker* MonikersTable;
if(SUCCEEDED(RunningObjectTable->EnumRunning(&MonikersTable)))
{
MonikersTable->Reset();
// Look for all visual studio instances in the ROT
IMoniker* CurrentMoniker;
while(AccessResult != EAccessVisualStudioResult::VSInstanceIsOpen && MonikersTable->Next(1, &CurrentMoniker, NULL) == S_OK)
{
IBindCtx* BindContext;
LPOLESTR OutName;
if(SUCCEEDED(CreateBindCtx(0, &BindContext)) && SUCCEEDED(CurrentMoniker->GetDisplayName(BindContext, NULL, &OutName)))
{
if(IsVisualStudioDTEMoniker(FString(OutName), InLocations))
{
TComPtr<IUnknown> ComObject;
if(SUCCEEDED(RunningObjectTable->GetObject(CurrentMoniker, &ComObject)))
{
TComPtr<EnvDTE::_DTE> TempDTE;
if (SUCCEEDED(TempDTE.FromQueryInterface(__uuidof(EnvDTE::_DTE), ComObject)))
{
// Get the solution path for this instance
// If it equals the solution we would have opened above in RunVisualStudio(), we'll take that
TComPtr<EnvDTE::_Solution> Solution;
BSTR OutPath = nullptr;
if (SUCCEEDED(TempDTE->get_Solution(&Solution)) &&
SUCCEEDED(Solution->get_FullName(&OutPath)))
{
FString Filename(OutPath);
FPaths::NormalizeFilename(Filename);
if (Filename == InSolutionPath)
{
OutDTE = TempDTE;
AccessResult = EAccessVisualStudioResult::VSInstanceIsOpen;
}
SysFreeString(OutPath);
}
else
{
UE_LOG(LogVSAccessor, Warning, TEXT("Visual Studio is open but could not be queried - it may be blocked by a modal operation"));
AccessResult = EAccessVisualStudioResult::VSInstanceIsBlocked;
}
}
else
{
UE_LOG(LogVSAccessor, Warning, TEXT("Could not get DTE interface from returned Visual Studio instance"));
AccessResult = EAccessVisualStudioResult::VSInstanceIsBlocked;
}
}
else
{
UE_LOG(LogVSAccessor, Warning, TEXT("Couldn't get Visual Studio COM object"));
AccessResult = EAccessVisualStudioResult::VSInstanceUnknown;
}
}
}
else
{
UE_LOG(LogVSAccessor, Warning, TEXT("Couldn't get display name"));
AccessResult = EAccessVisualStudioResult::VSInstanceUnknown;
}
BindContext->Release();
CurrentMoniker->Release();
}
MonikersTable->Release();
}
else
{
UE_LOG(LogVSAccessor, Warning, TEXT("Couldn't enumerate ROT table"));
AccessResult = EAccessVisualStudioResult::VSInstanceUnknown;
}
RunningObjectTable->Release();
}
else
{
UE_LOG(LogVSAccessor, Warning, TEXT("Couldn't get ROT table"));
AccessResult = EAccessVisualStudioResult::VSInstanceUnknown;
}
return AccessResult;
}