Visual C++ 5.0 Syntax

In Version 5.0 of Visual C++, the Microsoft Foundation Class (MFC) library provides an ActiveX interface. This topic describes how to use the interface with the LEADTOOLS COM Objects.

To create an instance of the object at run time, use the CreateInstanceLic function:

 

ILEADRasterInet *pRasterInet;

//Create the RasterInet object
HRESULT hr;
CLSID clsid;

*pRet = NULL;

hr = CLSIDFromProgID("LEADInet.LEADInet.120", &clsid);
if(!FAILED(hr))
{
   IClassFactory2 *pCF2=NULL;
   hr = CoGetClassObject(clsid, CLSCTX_ALL, NULL, IID_IClassFactory2, (void**)&pCF2);
   if(pCF2)
   {
      //ILEADRasterInet is licensed, so we need to pass a license key
      hr = pCF2->CreateInstanceLic(NULL, NULL, IID_ILEADRasterInet, pszLic, (void**)pRasterInet);
      pCF2->Release();
   } 
}

 

pszLic

Use the LEADTOOLS license string, which is always the first line in the LTOCX14.LIC file. For example: "LEADTOOLS OCX Copyright (c) 1991-2003 LEAD Technologies, Inc." If you do not specify this string correctly, the object will not be created.

To set a property value, the syntax is as follows:

m_controlname.Setpropertyname(value);

For example:

m_Lead1.SetRubberBandVisible(FALSE);

To get a property value, the syntax is as follows:

value = m_controlname.Getpropertyname();

For example:

HeightFactor = m_Lead1.GetBitmapHeight();

To set a property array value, the syntax is as follows:

m_controlname.Setpropertyname(index, value);

For example:

m_Lead1.SetRemapTable(MyIndex, (255 * Offset) / CurrentRange);

To get a property array value, the syntax is as follows:

value = m_controlname.Getpropertyname(index);

For example:

m_Lead1.SetBitmap(m_Lead1.GetColorPlanes(3)); // Copy the K plane