LBase::StatusCallBack

#include "ltwrappr.h"

virtual L_INT LBase::StatusCallBack (nPercentComplete)

L_INT nPercentComplete;

/* completion percentage */

Override this function to update a status bar or interrupt the calling function's operation.

Parameter

Description

nPercentComplete

An integer from 0 to 100 that indicates the completion percentage of the function that uses the callback.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Derived classes can override this function to update a status bar or interrupt the calling function's operation.

This generalized callback function can be called by many different Class Library functions. If this function returns a failure, the calling function will terminate and return the same error that the callback returned. Override this function in your derived class if you want to have control over the function in process. This function will be called only if the status callback is enabled for the class object.

Required DLLs and Libraries

LTKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Elements:

LBase::IsStatusCallBackEnabled, LBase::EnableStatusCallBack, Class Members

Example

#include <ltwrappr.h>
class LUserBitmap : public LBitmap  
{
public:
  LUserBitmap();
  virtual L_INT           StatusCallBack(L_INT nPercentComplete);
  virtual ~LUserBitmap();

};

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
LUserBitmap::LUserBitmap()
{
}

LUserBitmap::~LUserBitmap()
{

}

L_INT LUserBitmap::StatusCallBack(L_INT nPercentComplete)
{
   // display a message when 30% of the status is done.
   if(nPercentComplete == 30)
   {
      MessageBox(NULL, TEXT("30 Percent of AddNoise function is completed."), TEXT("StatusCallBack"), MB_OK);
   }
   return SUCCESS;
}

L_INT MyFunc(HWND hWnd)
{
   LUserBitmap LeadBitmap;
   HDC hDC;
   RECT rcClientRect;
   L_INT nRet;

   // get DC
   hDC = GetDC(hWnd);
   GetClientRect(hWnd, &rcClientRect);

   //Load an image
   LeadBitmap.Load(TEXT("V:\\images\\babe.cmp"), 0,ORDER_BGR);
   // Check if StatusCallBack is already enabled
   nRet = LeadBitmap.
IsStatusCallBackEnabled();
   if(nRet == FALSE)
      // Enable Status CallBack
      LeadBitmap.
EnableStatusCallBack(TRUE);
   // Call add noise function
   // during the calling of this function
   // StatusCallBack will be called
   LeadBitmap.
AddNoise();

    // Paint the image
   LeadBitmap.Paint()->
SetDC(hDC);
   LeadBitmap.
SetDstRect(&rcClientRect);
   LeadBitmap.Paint()->
PaintDC();
   ReleaseDC(hWnd, hDC);
   return SUCCESS;

}