AN197 Silicon_Laboratories, AN197 Datasheet - Page 8

no-image

AN197

Manufacturer Part Number
AN197
Description
Serial Communications Guide FOR THE Cp210x
Manufacturer
Silicon_Laboratories
Datasheet
AN197
ser);
&tmpPortKey))
(unsigned char *)portString, &length))
}
8
}
RegCloseKey(HKEY_LOCAL_MACHINE);
delete portString;
// Return the number of the port the device is connected too
return portNum;
}
RegCloseKey(tmpKey);
}
else
{
}
RegCloseKey(tmpSubKey);
}
//Make sure to close all open keys for cleanup
RegCloseKey(tmpPortKey);
portKeyString.Format("Vid_%04x&Pid_%04x\\%s\\Device
//If the portkey string is in the registry, then go ahead and open the portname
if
{
}
portString[0] = '0';
portString[1] = '0';
portString[2] = '0';
portNum = atoi(portString);
if (ERROR_SUCCESS == RegQueryValueEx(tmpPortKey, "PortName", NULL, &valtype,
{
// When we obtain this key, it will be in string format of
// "COMXX" where XX is the port. Simply make the first three
// elements of the string 0, and call the atoi function to obtain
// the number of the port.
portString[0] = '0';
portString[1] = '0';
portString[2] = '0';
portNum = atoi(portString);
}
//Make sure to close all open keys for cleanup
RegCloseKey(tmpPortKey);
(ERROR_SUCCESS
==
RegOpenKeyEx(tmpSubKey,
Rev. 0.6
portKeyString,
Parameters\\",
0,
vid,
KEY_READ,
pid,

Related parts for AN197