BOOL Dial(CString szURL)
{
GUID guid;
HANDLE iConnectionHandle = ConnMgrApiReadyEvent();
HRESULT hresult = ConnMgrMapURL((LPCTSTR)szURL,&guid,NULL);
if (FAILED(hresult))
{
MessageBox(L"映射地址不成功",L"错误",MB_OKCANCEL);
return FALSE;
}
// Get a connection.
CONNMGR_CONNECTIONINFO cinfo;
memset(&cinfo,0,sizeof(cinfo));
cinfo.cbSize = sizeof(cinfo);
cinfo.bDisabled = FALSE;
cinfo.bExclusive = FALSE;
cinfo.guidDestNet = guid;
cinfo.dwParams = CONNMGR_PARAM_GUIDDESTNET;
cinfo.dwFlags = CONNMGR_FLAG_PROXY_HTTP;
cinfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
DWORD status;
hresult = ConnMgrEstablishConnectionSync (&cinfo,&iConnectionHandle,15000,&status);
if (FAILED(hresult))
{
MessageBox(L"拨号不成功",L"错误",MB_OKCANCEL);
return FALSE;
}
return TRUE;
}