Using Object Identifiers
9/8/2008
O seguinte exemplo de código mostra como recuperar dados do objeto armazenar ou volume montado usando o identificador objeto Windows Embedded CE. Para obter mais informações, consulte 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"));
}
}