Using Object Identifiers (Windows CE 5.0)
The following code example shows how to retrieve data from the object store or mounted volume by using the Windows CE object identifier. For more information, see Objects and Object Identifiers.
void UsingCeOidGetInfo (void)
{
CEOID CeOid; // Object identifier
PCEGUID pceguid; // GUID of the mounted volume
CEOIDINFO CeObjectInfo; // Structure that will store retrieved data
// Object data
TCHAR szMsg[200]; // String to use with object data
// Assign to pceguid the CEGUID of the mounted volume
// on which the object resides.
// ...
// Assign to CeOid the object identifier of the object about which
// you want to get data.
// ...
CEGUID guid;
pceguid = &guid;
if (CeOidGetInfoEx (pceguid, CeOid, &CeObjectInfo))
{
switch (CeObjectInfo.wObjType)
{
case OBJTYPE_FILE:
wsprintf (szMsg, TEXT("Object is a file: %s"),
CeObjectInfo.infFile.szFileName);
break;
case OBJTYPE_DIRECTORY:
wsprintf (szMsg, TEXT("Object is a directory: %s"),
CeObjectInfo.infDirectory.szDirName);
break;
case OBJTYPE_DATABASE:
wsprintf (szMsg, TEXT("Object is a database: %s"),
CeObjectInfo.infDatabase.szDbaseName);
break;
case OBJTYPE_RECORD:
wsprintf (szMsg, TEXT("Object is a record"));
break;
case OBJTYPE_INVALID:
wsprintf (szMsg,
TEXT("The object store does not contain a valid ")
TEXT("object that has this object identifier."));
break;
default:
wsprintf (szMsg, TEXT("Object is of unknown OBJTYPE"));
break;
}
}
else
{
// Your error-handling code goes here.
if (GetLastError () == ERROR_INVALID_HANDLE)
wsprintf (szMsg, TEXT("Invalid Object ID"));
else
wsprintf (szMsg, TEXT("Unknown error"));
}
} // End of UsingCeOidGetInfo code
See Also
Send Feedback on this topic to the authors