meldsa
asked on
Need to programmatically get the name of my Windows CE device
I have a windows CE 5.0 device ( a Psion teklogix 7535 G2 handheld, specifically ), and I am trying to programmatically get the name of my device ( NOT the adapters, but the actual handheld's name). I am using EVC ( Embedded Visual C++) to code. You can manually see the device name that I am referring to if you go under System properties and then the device name tab. I am at a complete loss as to how to do this. Any help would be greatly appreciated. Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The code that worked for me as per Mikal63's helpful suggestions is
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("Ident"),
0, KEY_READ, &hKey ) == ERROR_SUCCESS)
{
DWORD dwType = REG_SZ;
DWORD dwDataSize = 0;
CString deviceName;
if ( RegQueryValueEx( hKey, _T("name"), 0, &dwType, (PBYTE)NULL,
&dwDataSize ) == ERROR_SUCCESS)
{
RegQueryValueEx( hKey, _T("name"), 0, &dwType,
(PBYTE)(LPTSTR)deviceName.GetBuffer(dwDataSize + 1),
&dwDataSize );
deviceName.ReleaseBuffer();
}
RegCloseKey(hKey);
}
ASKER