This function allows an application to register a status function to be called during image loading with the completed percentage of the loading process.
|
Parameter |
Type |
Description |
|
hImg |
HANDLE |
Specifies the image to register the status function for. |
|
lpStat |
STATUSPROC |
Pointer to the function to call each interval. |
|
lCnt |
LONG |
Specifies the interval between calls to lpStatProc. This is based on the size of the created image. |
|
dwInfo |
DWORD |
Any user-defined information the application might want to pass to the status procedure. |
Return Value
The return value is IMG_OK.
Comments
Use this function to implement a bar-chart during loading of the image file. If you have specified a default status proc, this function will override it.
Note that this function will be called with a 100% completion value even if there is an error loading the image. This will give your application a way to detect that ImageMan is done loading an image.
You should keep in mind the fact that the image load doesn't necessarily occur directly following the ImgOpen function call (unless you tell it to, of course.)
Example
// declare my status procedure like this:
int IMAPI status(HANDLE hImg, int nPercent, DWORD dwUserInfo);
.
.
// tell ImageMan to use my status procedure, calling it every
// 25000 bytes. I'll also pass in the handle of my status window.
ImgSetDefaultStatusProc(status, 25000L, (DWORD)hWndStatus);
.
.
// now I'll override ImageMan's default status procedure so I
// can set a larger interval for this particular image.
ImgSetStatusProc(hImage, status, 100000L, (DWORD)hWndStatus);
.
.
int IMAPI status(HANDLE hImg, int nPercent, DWORD dwUserInfo)
{
char buf[50];
HDC hDC;
// I know that dwUserInfo is the handle to my status window
wsprintf(buf,"%d%%", nPercent);
hDC = GetDC((HWND)LOWORD(dwUserInfo));
TextOut(hDC, 0, 20, buf);
ReleaseDC((HWND)Loword(dwUserInfo), hDC);
}
© 1995-2004 Data Techniques, Inc. All rights reserved.