General utility function.
Returns the file import progress.
DioFileImportGetProgress (phHandle, pszStatus, nStatusMaxLen, pnStatus)
Name |
Type |
Comments |
phHandle |
PHANDLE |
A HANDLE to the file import object that was returned by DioFileImport API, in order to monitor the progress of the import file process. |
pszStatus |
PSTR |
Buffer to contain the returned status string (null terminated).This string will be empty while the file import is in progress (based on pnStatus parameter).When the file import is done, if the file import finish successfully this string will be empty or in case of a warning it will contain the warning message.In case of an error (pnStatus is negative), it will contain the error message. |
nStatusMaxLen |
SHORT |
Size of the buffer to contain the status string. |
pnStatus |
PSHORT |
When the file import is in progress pnStatus returns the percentage that was completed, from 1% to 100%. When file import is complete it returns 0 on success or <0 on failure. |
The function can only be used after the user called DioFileImport and specified bWait =FALSE.
The following example converts a STIL file to a Gx5295 DIO with Real time compare file and monitoring the progress (bWait=FALSE):
SHORT nStatus;
CHAR szStatus[512];
HANDLE hHandle;
DioFileImport (“InputStilFile.stil”, “OutputDioFile.dio”, DIO_BOARD_TYPE_GX5295, TRUE, NULL, 0, FALSE, &hHandle, szStatus, sizeof (szStatus), &nStatus);
// Monitor the import file process
while (nStatus>=0)
{
DioFileImportGetProgress(hHandle, szStatus, sizeof (szStatus), &nStatus);
if (nStatus>0)
printf(“Progress = %i”, (int) nStatus); // continue
else
break;
// wait for import to finish or time out every 250ms without consuming the CPU
WaitForSingleObject(hHandle, 250);
}
printf(szStatus); // print complete (nStatus=0), warning, errrors