Deleting Property Databases

< BACK  NEXT >
[oR]

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))       cout   _T("Database deleted")   endl;     else       cout   _T("Database not deleted")   endl;   } } 

Remember, it is important to initialize ceOidDB to zero, otherwise CeOpenDatabaseEx will attempt to use the value as a valid database object identifier. You cannot delete a database that is open, so ensure that you close the database before attempting to delete it.

Table 4.10. CeDeleteDatabaseEx Deletes a property database
CeDeleteDatabaseEx
PCEGUID pceguid CEGUID of a mounted database volume
PCEOID oidDbase Object identifier of database to delete
BOOL Return Value Returns TRUE if database is deleted


< BACK  NEXT >


Windows CE 3. 0 Application Programming
Windows CE 3.0: Application Programming (Prentice Hall Series on Microsoft Technologies)
ISBN: 0130255920
EAN: 2147483647
Year: 2002
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net