LBase::StatusCallBack

#include "ltwrappr.h"

virtual L_INT LBase::StatusCallBack (nPercentComplete)

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

Parameters

L_INT nPercentComplete

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

Returns

Value Meaning
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 C++ 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

Platforms

Win32, x64.

See Also

Example

class LStatusBitmap : public LBitmap   
{ 
public: 
  LStatusBitmap(); 
  virtual L_INT           StatusCallBack(L_INT nPercentComplete); 
  virtual ~LStatusBitmap(); 
 
}; 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
//////////////////////////////////////////////////////////////////// 
 
LStatusBitmap::LStatusBitmap() 
{ 
} 
 
LStatusBitmap::~LStatusBitmap() 
{ 
 
} 
 
L_INT LStatusBitmap::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 LBase__StatusCallBackExample(HWND hWnd) 
{ 
	L_INT nRet; 
   LStatusBitmap LeadBitmap; 
   HDC hDC; 
   RECT rcClientRect; 
 
   // get DC 
   hDC = GetDC(hWnd); 
   GetClientRect(hWnd, &rcClientRect); 
 
   //Load an image 
   nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.cmp")), 0,ORDER_BGR); 
	if(nRet != SUCCESS) 
		return nRet; 
   // 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 
   nRet = LeadBitmap.AddNoise(); 
	if(nRet != SUCCESS) 
		return nRet; 
 
    // Paint the image 
   LeadBitmap.Paint()->SetDC(hDC); 
	 
   nRet = LeadBitmap.SetDstRect(&rcClientRect); 
	if(nRet != SUCCESS) 
		return nRet; 
   nRet = LeadBitmap.Paint()->PaintDC(); 
	if(nRet != SUCCESS) 
		return nRet; 
   ReleaseDC(hWnd, hDC); 
   return SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.