Hi,
I am using VS2005 VC++ to detect the cradle USB connection, below is my code:
DWORD lpcb;
DWORD lpcConnections;
RASCONN rasconn;
bool _returnvalue = false;
rasconn.dwSize = sizeof(RASCONN);
lpcb = sizeof(RASCONN);
LPRASCONN lp = &rasconn;
DWORD ret = RasEnumConnections(lp, &lpcb, &lpcConnections );
CString _a;
_a.Format(L"ret=%i",ret);
AfxMessageBox(_a);
_a.Format(L" lpc=%i",lpcConnections);
AfxMessageBox(_a);
if ((ret == 0) && (lpcConnections > 0)){
for (int i = 0;i< (int)lpcConnections;i++){
CString _entryname;
_entryname.Format(_T("%s"),rasconn.szEntryName);
if((_entryname.CompareNoCase(_T("`USB"))) == 0)
_returnvalue = true;
lp++;
}
} else {
AfxMessageBox(L"no conn.");
}
This code work with PPC 2003 (ret=0 and lpconnections = 1) but not in WM5
(ret=0 and lpconnections = 0). Can anyone tell me how to detect the USB
cradle connection in WM5 ?
Thank you