Search Pocket PC Life's 126 Pocket PC-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
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;
}


« Previous  ·  1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Phones and PDAs > Windows Mobile > Programming (3 articles)
   HP hotkeys, OK buttons, and file existence
   Freeing up DLLs, avoiding suspend mode, and listbox tricks
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
More from the ZATZ journals
Computing Unplugged: Smartphone smarts for a mobile world
David Gewirtz Online: CNN commentary and analysis
DominoPower: It's time for Lotus to double-down on Linux and open source
OutlookPower: The strange case of Outlook losing notes and requiring passwords
-- Advertisement --

ONLINE GROUP CALENDAR - FOR UP TO 100 OF YOUR CLOSEST FRIENDS
Stay organized and in control with 24/7 access to all of your important events, projects and files --whether you're at work, at home or on the road.

You can share your calendar, projects and files so everyone in your office is up to date. Plus, search your entire group to find times when everyone is available to meet, manage company resources and much more.

Organize your entire team for as low as $9.95 per year (and yes, that's where the decimal place is supposed to be!)

Tap here to get started right away.

-- Advertisement --

Printing emails and attachments has never been simpler
When it comes to printing emails or attachments, you can be confident that our Auto-Print add-in can do what Outlook lacks - print the emails and/or attachments as soon as they arrive.

Discover this professional tool today.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1999-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login