Click here to Skip to main content
15,917,455 members
Home / Discussions / COM
   

COM

 
GeneralRe: converting an idl file to .h Pin
Vi227-Jun-03 1:24
Vi227-Jun-03 1:24 
GeneralProblem in passing structure pointer via Interface Pin
mpb24-Jun-03 20:48
mpb24-Jun-03 20:48 
GeneralRe: Problem in passing structure pointer via Interface Pin
Aravinthan25-Jun-03 3:03
Aravinthan25-Jun-03 3:03 
GeneralRe: Problem in passing structure pointer via Interface Pin
mpb29-Jun-03 19:01
mpb29-Jun-03 19:01 
GeneralSetProperty returns "this property is read-only" Pin
Lynnzi24-Jun-03 14:16
Lynnzi24-Jun-03 14:16 
GeneralInternalGetText() issue Pin
Marion2824-Jun-03 4:45
Marion2824-Jun-03 4:45 
GeneralOLE mini server problem Pin
acosmin23-Jun-03 21:32
acosmin23-Jun-03 21:32 
GeneralInproc Server in a Surrogate Process Pin
Anonymous23-Jun-03 18:32
Anonymous23-Jun-03 18:32 
Hello, I'm having a problem obtaining an interface pointer (ICreateCar*) on an inproc server that is hosted in dllhost.exe and am unsure if I am overlooking something. Funny as it may seem, if I use the CLSCTX_INPROC_SERVER in the CoCreateInstance or CoGetClassObject call it's successful and I am able to use the requested interface pointer. If I use CLSCTX_LOCAL_SERVER and check the HRESULT after the CreateInstance call has returned the return value is "-2147221163" (Interface not Registered). I have stepped through the code with the Visual C++ Debugger and I'm finding that when I call CreateInstance on a class factory pointer, CreateInstance is able to obtain a valid interface pointer through the QueryInterface call. The HRESULT that is returned from this QueryInterface call is the value that is returned from CreateInstance (in this case it's 0). When I check the HRESULT that is returned from CreateInstance it's not the same value that was returned from the QueryInterface call that was performed in CreateInstance.

Please help, what am I doing wrong?

Thank you.

Client code
<code>	
CoInitialize(NULL);
HRESULT hr;
IClassFactory* pCF = NULL;
ICreateCar* pCreateCar = NULL;

hr = CoGetClassObject(CLSID_CoCar, CLSCTX_LOCAL_SERVER, NULL, IID_IClassFactory, (void**)&pCF);
if (SUCCEEDED(hr))
{		
   hr = pCF->CreateInstance(NULL, IID_ICreateCar, (void**)&pCreateCar);
   pCF->Release();
   if (SUCCEEDED(hr))
   {
      pCreateCar->SetMaxSpeed(100);			
   }
}

</code>


CreateInstance

<code>
STDMETHODIMP CoCarFactory::CreateInstance(IUnknown* pIUnk, REFIID riid, void** ppvObject)
{
   if (pIUnk != NULL)
   {
      return CLASS_E_NOAGGREGATION;
   }
   CoCar* pCoCarObj =  NULL;
   HRESULT hr;
   pCoCarObj = new CoCar();
   hr = pCoCarObj->QueryInterface(riid, ppvObject);
   if (FAILED(hr))
   {
      delete pCoCarObj;
   }
   return hr;
}
</code>

GeneralRe: Inproc Server in a Surrogate Process Pin
Vi224-Jun-03 18:35
Vi224-Jun-03 18:35 
GeneralRe: Inproc Server in a Surrogate Process Pin
Anonymous25-Jun-03 11:14
Anonymous25-Jun-03 11:14 
Generalevents fired by Internet Explorer Pin
shai197423-Jun-03 11:18
shai197423-Jun-03 11:18 
GeneralRe: events fired by Internet Explorer Pin
Amit Dey26-Jun-03 13:52
Amit Dey26-Jun-03 13:52 
GeneralRe: events fired by Internet Explorer Pin
shai197426-Jun-03 13:54
shai197426-Jun-03 13:54 
GeneralRegistering a class Pin
tessierjf23-Jun-03 4:37
tessierjf23-Jun-03 4:37 
Generaltest container crashes Pin
safee ullah22-Jun-03 21:16
safee ullah22-Jun-03 21:16 
GeneralRe: test container crashes Pin
Marion2827-Jun-03 4:42
Marion2827-Jun-03 4:42 
GeneralCOM Question Pin
Nick Parker22-Jun-03 4:39
protectorNick Parker22-Jun-03 4:39 
GeneralRe: COM Question Pin
valikac22-Jun-03 7:32
valikac22-Jun-03 7:32 
GeneralRe: COM Question Pin
Aravinthan25-Jun-03 3:08
Aravinthan25-Jun-03 3:08 
QuestionHow can my ActiveX control get the data of the file which locates on the server? Pin
stanley guan21-Jun-03 1:18
stanley guan21-Jun-03 1:18 
AnswerRe: How can my ActiveX control get the data of the file which locates on the server? Pin
valikac21-Jun-03 7:41
valikac21-Jun-03 7:41 
GeneralCOM interop in .NET Pin
slnarasimhan19-Jun-03 22:28
slnarasimhan19-Jun-03 22:28 
GeneralThird party program library method calls invocation Pin
yeeck19-Jun-03 21:14
yeeck19-Jun-03 21:14 
GeneralCOM+ Error Pin
Aky18-Jun-03 23:31
Aky18-Jun-03 23:31 
GeneralRe: COM+ Error Pin
Steve S23-Jun-03 21:50
Steve S23-Jun-03 21:50 

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.