Hi All!

I am traversing the ROT(running Object Table) to get active instance of Visio, but this fails at line-14 in following code snippet:

line1: IMoniker *pmon;
line2: while(pem->Next(1, &pmon, &fetched) == S_OK)
line3: {
line4: // Get DisplayName.
line5: LPOLESTR pName;
line6: pmon->GetDisplayName(pbc, NULL, &pName);
line7: // Convert it to ASCII.
line8: char szName[512];
line9: WideCharToMultiByte(CP_ACP, 0, pName, -1, szName, 512, NULL,NULL);
line10: if(!strcmp(szName, "!{00021A20-0000-0000-C000-000000000046}")) //If Visio's CLSId found
line11: {
line12: // Bind to this ROT entry.
line13: IDispatch *pDisp;
line14: hr = pmon->BindToObject(pbc, NULL, IID_IDispatch, (LPVOID*)&pDisp);//Error in this line
line15: }
line16: }//End of while

Following error come from line 14:
BindToObject(), Error: -2147024809 (80070057)

What might be wrong in the code? I would esteemed it a great help, thanks in anticipation.

Kind Reagrds,
Vicky