|
|
|
|
|
|
|
|
|
|
Palm-sized input panel quirks and mounted database volumes (continued)
Is there a way to programmatically show or hide the SIP? Of course there is! The function SHSipInfo(), which is located in aygshell.lib, can be used to determine the current status of the SIP as well as set SIP information. So, if you wanted to hide or show the SIP, use code like this:
BOOL DisplaySIP(BOOL fShow)
{
SIPINFO si;
memset(&si, 0, sizeof(si));
si.cbSize = sizeof(SIPINFO);
if(!SHSipInfo(SPI_GETSIPINFO, 0, &si, 0))
return FALSE;
if(fShow)
si.fdwFlags |= SIPF_ON;
else
si.fdwFlags &= ~SIPF_ON;
SHSipInfo(SPI_SETSIPINFO, 0, &si, 0);
return TRUE;
}
|
Ok. I give up. How can you create databases on a flash card? The first thing that you should be aware of is that this functionality was introduced with Windows CE 2.1, and won't work on earlier versions of the operating system. With that said, when using any type of external device, such as a flash card, you must first mount the volume before you can work with the extended database APIs. External database volumes contain both your data and integrity logs for your various databases.
"This functionality was introduced with Windows CE 2.1, and won't work on earlier versions of the operating system."
|
In order to mount a database volume you need to call the CeMountDBVol() function. Besides passing in a variable to receive the pointer to your CEGUID object and the null-terminated path to your external database file, you'll also have to pass in a database creation flag. (You might notice that this flag is similar to opening a file).
The flag will be one of the following options: CREATE_NEW (create a new database), CREATE_ALWAYS (always create a new database, even if one of the same name already exists), OPEN_EXISITING (open an existing database), OPEN_ALWAYS (open the database, if doesn't exist, create a new one), or TRUNCATE_EXISTING (open an existing database, and truncate it to 0).
Once you've mounted the database volume, you can use the Ex versions of the database APIs to work with your external database. The only difference between the regular and Ex functions is that these new functions take the returned CEGUID (from your call to CeMountDBVol) as an additional parameter. For example, say we wanted to enumerate the databases on a mounted volume, your code might look like this:
BOOL EnumerateDatabases()
{
BOOL fEnum = TRUE;
CEGUID pCeGUID;
HANDLE hDB = NULL;
// Mount the database volume
if(!CeMountDBVol(&pCeGUID, TEXT("\\Storage Card\\Databases.vol"), OPEN_EXISTING))
return FALSE;
// Enumerate through mounted databases in the volume
if(hDB = CeFindFirstDatabaseEx(&pCeGUID, 0)) {
while(fEnum) {
CEOID dbOID = CeFindNextDatabaseEx(hDB, &pCeGUID);
if(!dbOID) {
if(GetLastError() == ERROR_NO_MORE_ITEMS) {
fEnum = FALSE;
continue;
}
}
// Get some information on the database
CEOIDINFO ceOIDInfo;
memset(&ceOIDInfo, 0, sizeof(CEOIDINFO));
if(!CeOidGetInfoEx(&pCeGUID, dbOID, &ceOIDInfo)) {
// Some error has occurred, so, quit
fEnum = FALSE;
continue;
}
// Do something here with the database name
MessageBox(NULL, ceOIDInfo.infDatabase.szDbaseName, TEXT("Database Name"), MB_OK);
}
CloseHandle(hDB);
}
// Clean things up and get outta here
CeUnmountDBVol(&pCeGUID);
return TRUE;
}
|
[ Prev | Next ]
|
|
|
|
|
|
-- Advertisement --
BLOGGING AND PODCASTING WITH ONE EASY-TO-USE TOOL
Now you can publish your thoughts, opinions, and comments in your own blog or podcast.<p />
- Supports multiple authors and multiple blogs or podcasts.
- Generate and publish RSS feeds for iTunes and other directories.
- Post photos, images or animations.
- Get feedback and have conversations with visitors to your site. <p />
Personalize your blog or podcast with your own unique domain name — or integrate it with your existing site by setting it up as a subdomain.
Tap here and get blogging or podcasting within minutes. |
-- Advertisement --
Safeguard Send Add-In for Outlook
Avoid mistakes when sending emails - our Outlook add-in tool automatically checks to make sure that replies are going to the right people, confidential information is not being sent to the wrong people, and more.
See this and our complete list of 37 other powerful add-ins at our Web site. |
|
|
|
|
|
|
|
|