2 xyxoo004 xyxoo004 于 2013.08.06 10:13 提问

Hyper-v远程连接问题,请教大神。

#define CHK_HRES(op) \
{ \
HRESULT tmp_hresult___ = op; \
if (FAILED(tmp_hresult___)) \
throw CAtlException(tmp_hresult___); \
}

void CChildDlg7::OnHyper_v(){

//CHK_HRES(pObject->Method());

CComBSTR namespacePath = L"\\\\";
CString pServer;
this->GetDlgItemText(IDC_EDIT1,pServer);
//this->GetDlgItemText(IDC_LIST1,pServer);
namespacePath  = pServer;
namespacePath  += L"\\root\\virtualization";
pUserName= pServer;
pPassword= pServer;
CComPtr<IWbemLocator> pWbemLocator;
CHK_HRES(pWbemLocator.CoCreateInstance( CLSID_WbemLocator,
    NULL, 
    CLSCTX_INPROC_SERVER));

CComPtr<IWbemServices> pWbemServices;

CHK_HRES(pWbemLocator->ConnectServer(
    namespacePath, 
    CComBSTR(pUserName),
    CComBSTR(pPassword), 
    NULL, 
    0, 
    NULL, 
    NULL, 
    &pWbemServices
    ));    现在一运行到这地方程序会崩掉,有大神帮看一下么!?
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!