I'm planning to use VFSImportDatabaseFromFile to get a 4+mb file from a
flash-card into device memory. On a Tungsten E2, this takes 30 to 40 seconds
... ouch.
I want to put up some kind of progress indicator while this is happening, and
would appreciate guidance on how to go about this.
Is the following "stub code" more or less appropriate? (But I'm not clear how
to "re-arm" the "ProgressFunction" so it repeats until the
VFSImportDatabaseFromFile gets done)
static void ProgressFunction(UInt32 ref)
{
if (gbVFSImportWorking == TRUE) {
// do something to show progress
FieldType * field = GetObjectPtr<FieldType>
(MainDescriptionField);
FldInsert(field, "Progress ", 9);
UInt32 curTimeSeconds = TimGetSeconds();
AlmSetProcAlarm(ProgressFunction, 0, curTimeSeconds + 1);
}
}
// MainCode
FieldType * field = GetObjectPtr<FieldType>(MainDescriptionField);
FldInsert(field, "Import clicked", 14);
UInt32 curTimeSeconds = TimGetSeconds();
gbVFSImportWorking = true;
AlmSetProcAlarm(ProgressFunction, 0, curTimeSeconds + 1);
errRc = VFSImportDatabaseFromFile(m_volRefNum,
szFullFilename,
&cardNo, &fileRef);
gbVFSImportWorking = false;
m_curDbTransRef = DmOpenDatabaseByTypeCreator(m_dbTransType,
APP_FILE_CREATOR,
dmModeReadOnly);
The ProgressFunction is reached ok ... and I've been able to issue a series of
the following:
UInt32 curTimeSeconds = TimGetSeconds();
AlmSetProcAlarm(ProgressFunction, 0, curTimeSeconds + 1);
However, when I close the test-app, I get a SysFatalAlarm regarding "Object
#1009 in form #1000 is missing.
Is there a better approach to accomplish this?
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/