佚名通过本文主要向大家介绍了
在调用CreateInstanceEx激活DCOM服务端时,返回错误:服务器运行失败。请高手解答!等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
    
  
                问题: 在调用CreateInstanceEx激活DCOM服务端时,返回错误:服务器运行失败。请高手解答!
描述:
解决方案1:
                    
 
   
 
 
 
描述:
            在调用CreateInstanceEx()激活DCOM服务端时,返回错误:服务器运行失败。
以下是客户端的部分代码:
         CoInitialize(NULL);
	HRESULT hr = E_FAIL;	
	wchar_t szServerIp[] = L"192.168.1.31";	
	IEvent1* pIEvent1 = NULL;
	COSERVERINFO cs;
	ZeroMemory(&cs, sizeof(cs));
	cs.pwszName = szServerIp;
	MULTI_QI mqi[1] = {{&IID_IEvent1, 0, 0}}; 
	hr = CoCreateInstanceEx(CLSID_Event1, NULL, CLSCTX_SERVER, &cs, 1, mqi);
	if (hr == S_OK || SUCCEEDED(mqi[0].hr))
	{
		// Extract the interface from the MULTI_QI strucure
		pIEvent1 = reinterpret_cast<IEvent1*>(mqi[0].pItf);
	}
	else
	{
		CoErrorMessage(hr);
		return FALSE;
	}
解决方案1:
返回什么错误码?

