Click here to Skip to main content
15,887,353 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Is it a good practice to use continue Pin
Richard MacCutchan12-Apr-13 5:01
mveRichard MacCutchan12-Apr-13 5:01 
GeneralRe: Is it a good practice to use continue Pin
Erudite_Eric16-Apr-13 4:58
Erudite_Eric16-Apr-13 4:58 
GeneralRe: Is it a good practice to use continue Pin
Richard MacCutchan16-Apr-13 5:21
mveRichard MacCutchan16-Apr-13 5:21 
AnswerRe: Is it a good practice to use continue Pin
Stephen Hewitt12-Apr-13 3:46
Stephen Hewitt12-Apr-13 3:46 
AnswerRe: Is it a good practice to use continue Pin
H.Brydon12-Apr-13 11:48
professionalH.Brydon12-Apr-13 11:48 
GeneralRe: Is it a good practice to use continue Pin
shailesh9108212-Apr-13 22:27
shailesh9108212-Apr-13 22:27 
AnswerRe: Is it a good practice to use continue Pin
Stefan_Lang18-Apr-13 5:13
Stefan_Lang18-Apr-13 5:13 
QuestionBindToObject fails - DirectShow remote graph access Pin
Vaclav_11-Apr-13 8:27
Vaclav_11-Apr-13 8:27 
<pre lang="I am trying to gain “remote” access to DirectShow graph.
The graph is in Running Object Table under name.
I can retrieve / enumerate the ROT and get the named moniker.
However, my call to BindToObject fails.
Basically, I am not sure if I have the call to this method set properly.
My question is – since I am looking for a graph interface – do I need to pass graph interface or can I use Iunknown? It fails both ways.
I am nor really sure how to get the graph to the MFC document, but that is next step.
I am enclosing my code snippets , please note - it is under deconstruction and full of notes / comments.
I like it that way.
Any help will be as always appreciated.
Cheers
Vaclav
"></pre>




TRACE("\nHRESULT CDS::C_AddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister)");
IMoniker * pMoniker;
IRunningObjectTable *pROT;

IEnumMoniker *pMonikersTable;
IMoniker *pCurrentMoniker;
int iTestCount = 0;

WCHAR wsz[128] = L"Video" ; // MN used to retrive
HRESULT hr;
if (!pUnkGraph || !pdwRegister)
{
TRACE("\n!pUnkGraph || !pdwRegister");
return E_POINTER;
}
TRACE("\nGetRunningObjectTable ");
if (FAILED(GetRunningObjectTable(0, &pROT)))
{
TRACE("\nGetRunningObjectTable(0, &pROT)");
return E_FAIL;
}
// test enumerate before usage
pROT->EnumRunning(&pMonikersTable);
hr = pMonikersTable->Reset();
if(FAILED(hr))
{
TRACE("\nFailed pROT->Register(.. ");
}
while(pMonikersTable->Next(1, &pCurrentMoniker, NULL) == S_OK)
{
iTestCount++;
TRACE("\n");
}
/*
hr = StringCchPrintfW(wsz, NUMELMS(wsz), L"FilterGraph %08x pid %08x\0", (DWORD_PTR)pUnkGraph,
GetCurrentProcessId());
*/
TRACE("\nCreateItemMoniker using name ");
hr = CreateItemMoniker(L"!", wsz, &pMoniker);
if (SUCCEEDED(hr)) {
TRACE("\nRegister moniker ");
// Use the ROTFLAGS_REGISTRATIONKEEPSALIVE to ensure a strong reference
// to the object. Using this flag will cause the object to remain
// registered until it is explicitly revoked with the Revoke() method.
//
// Not using this flag means that if GraphEdit remotely connects
// to this graph and then GraphEdit exits, this object registration
// will be deleted, causing future attempts by GraphEdit to fail until
// this application is restarted or until the graph is registered again.
hr = pROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, pUnkGraph,
pMoniker, pdwRegister);
if(FAILED(hr))
{
TRACE("\nFailed pROT->Register(.. ");
}
pMoniker->Release();
}
pROT->Release();


THIS IS A DIFFERENT "FUNCTION"

HRESULT hr;
TRACE("\nBind to control "); // Get a BindCtx.
IBindCtx *pbc;
hr = CreateBindCtx(0, &pbc);
if(FAILED(hr))
{
TRACE("\nCreateBindCtx()", hr);
return false;
}

TRACE("\nGet running-object table.");
IRunningObjectTable *prot;
hr = pbc->GetRunningObjectTable(&prot);
if(FAILED(hr))
{
TRACE("\nCreateBindCtx()", hr);
prot->Release();
return false;
}
TRACE("\nGet enumeration interface.");
IEnumMoniker *pem; // enumerated moniker
hr = prot->EnumRunning(&pem);
if(FAILED(hr))
{
TRACE("\nCreateBindCtx()", hr);
prot->Release();
pbc->Release();
return false;
}
// Start at the beginning.
pem->Reset();
// Churn through enumeration.
ULONG fetched; // actuall number of items retrived , could ve set to NULL
IMoniker *pmon;
int n = 0;
while(pem->Next(1, &pmon, &fetched) == S_OK)
{
TRACE("\nGet moniker for %s Graph name ", strName); // Get DisplayName.
LPOLESTR pName;
pmon->GetDisplayName(pbc, NULL, &pName);
// Convert it to ASCII.
char szName[512];
WideCharToMultiByte(CP_ACP, 0, pName, -1, szName, 512, NULL,
NULL);
TRACE("\nCompare with Moniker name %s",szName); // Compare it against the name we got in SetHostNames().
if(strName.CompareNoCase(szName) /* "!Video")*/ == 0 )
//if(!strcmp(szName, "!Video")) //MN for now
{
TRACE("\nBind to this ROT entry moniker named %s",strName);
/*
IDispatch *pDisp;
hr = pmon->BindToObject(pbc, NULL, IID_IDispatch, (void
**)&pDisp);
*/
IUnknown *pUnkGraph;
hr = pmon->BindToObject(pbc, NULL, IID_IUnknown, (void
**)&pUnkGraph);


if(!FAILED(hr))
{
TRACE("\nBound to object ");
// Remember IDispatch.
// m_pDocDisp = pDisp;
// Notice...
//sprintf(buf, "Document IDispatch = %08lx",
//m_pDocDisp);
//DoMsg(buf);
break;
}
else
{
AfxMessageBox("Failed IUnknown *pUnkGraph;");
TRACE("\nFailed BindToObject() %i ", hr);
}
}
// Release interfaces.
pmon->Release();
// Break out if we obtained the IDispatch successfully.
// if(m_pDocDisp != NULL) break;

}
// Release interfaces.
pem->Release();
prot->Release();
pbc->Release();


<pre lang="text">PS I cannot do "preview" getting "specified module cannot be found".
So if tthis post is too messy, sorry about that </pre>
QuestionRe: BindToObject fails - DirectShow remote graph access Pin
Richard MacCutchan11-Apr-13 21:47
mveRichard MacCutchan11-Apr-13 21:47 
AnswerRe: BindToObject fails - DirectShow remote graph access Pin
Vaclav_12-Apr-13 4:32
Vaclav_12-Apr-13 4:32 
GeneralRe: BindToObject fails - DirectShow remote graph access Pin
Richard MacCutchan12-Apr-13 4:58
mveRichard MacCutchan12-Apr-13 4:58 
QuestionGetLastInputInfo getting system wide idle info Pin
Donguy197611-Apr-13 6:52
Donguy197611-Apr-13 6:52 
AnswerRe: GetLastInputInfo getting system wide idle info Pin
jeron111-Apr-13 7:31
jeron111-Apr-13 7:31 
Question[VC++ and XAML] Keydown event bug for metro app programming Pin
Member 997974310-Apr-13 19:35
professionalMember 997974310-Apr-13 19:35 
GeneralRe: [VC++ and XAML] Keydown event bug for metro app programming Pin
enhzflep10-Apr-13 21:15
enhzflep10-Apr-13 21:15 
AnswerRe: [VC++ and XAML] Keydown event bug for metro app programming Pin
dusty_dex11-Apr-13 0:49
dusty_dex11-Apr-13 0:49 
Question"Creating variable" at runtime - message decoding Pin
HellMaster[cz]10-Apr-13 19:03
HellMaster[cz]10-Apr-13 19:03 
AnswerRe: "Creating variable" at runtime - message decoding Pin
Richard MacCutchan10-Apr-13 21:41
mveRichard MacCutchan10-Apr-13 21:41 
GeneralRe: "Creating variable" at runtime - message decoding Pin
HellMaster[cz]10-Apr-13 22:10
HellMaster[cz]10-Apr-13 22:10 
GeneralRe: "Creating variable" at runtime - message decoding Pin
Richard MacCutchan10-Apr-13 22:34
mveRichard MacCutchan10-Apr-13 22:34 
GeneralRe: "Creating variable" at runtime - message decoding Pin
HellMaster[cz]10-Apr-13 23:15
HellMaster[cz]10-Apr-13 23:15 
GeneralRe: "Creating variable" at runtime - message decoding Pin
Richard MacCutchan10-Apr-13 23:22
mveRichard MacCutchan10-Apr-13 23:22 
GeneralRe: "Creating variable" at runtime - message decoding Pin
HellMaster[cz]10-Apr-13 23:27
HellMaster[cz]10-Apr-13 23:27 
GeneralRe: "Creating variable" at runtime - message decoding Pin
Jonathan Davies11-Apr-13 0:17
Jonathan Davies11-Apr-13 0:17 
AnswerRe: "Creating variable" at runtime - message decoding Pin
Jonathan Davies10-Apr-13 22:47
Jonathan Davies10-Apr-13 22:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.