Deleting Property Databases

A property database can be deleted by calling CeDeleteDatabaseEx. This function requires the CEGUID of the mounted database volume and the object identifier of the database to delete. The easiest way to obtain the object identifier is to call CeOpenDatabaseEx passing in the name of the database, and the object identifier is returned in ceOidDB, as illustrated in Listing 4.6.

Listing 4.6. Deletes a database
 void Listing4_6() { CEGUID ceObjStore; CEOID ceOidDB = 0; HANDLE hDB; CREATE_SYSTEMGUID(&ceObjStore); hDB = CeOpenDatabaseEx(&ceObjStore, &ceOidDB, _T("Company"), 0,0, NULL); if(hDB == INVALID_HANDLE_VALUE) cout ≪ _T("Could not open database") ≪ endl; else { CloseHandle(hDB); if(CeDeleteDatabaseEx(&ceObjStore, ceOidDB)) ...

Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.