Glossary Item Box
This function is used to retrieve relevant information about the plug-ins found in the directory specified in the ImgHostLoad call. A typical use for this is to enumerate all the plug-ins in the plug-in directory and populate a drop-down list box to show the user a selection of the plug-ins currently installed that can be invoked.
|
Parameter |
Type |
Description |
|
enumProc |
PIIMENUMCALLBACKPROC |
Your enumeration call back function. |
|
lPIType |
LONG |
The type of plug-in to enumerate (see Comments below). |
|
LParam |
LONG |
Any user supplied information. |
|
typedef |
BOOL |
(IMAPI * PIIMENUMCALLBACKPROC)(LPSTR ln,LPSTR fn,LPSTR ct,LONG dw) ; |
|
PIIMENUMCALLBACKPROC Parameter |
Type |
Description |
|
ln |
LPSTR |
The plug-in's long name or title such E's Cool Convolver . |
|
fn |
LPSTR |
The actual plug-in's file name without the path such as coolplug.8bf. |
|
ct |
LPSTR |
The category that a plug-in belongs to. |
|
dw |
LONG |
Any user-define value.#define IM_PI_FILTER 0X00000020 |
Return Value
Returns IMG_OK if successful, otherwise IMG_ERR. If it returns IMG_ERR, use the ImgGetStatus function to get error code or ImgErrBox() to display the error message.
Comments
Although, you may find other filter types defined in the imgman.h header file, only IM_PI_FILTER is currently implemented. The others are for potential future use.
Example
// first lets make a PlugInItem class
class CPlugInItem
{
private :
CString csLongName ;
CString csCategory ;
CString csFilter ;
public :
CPlugInItem () {} ;
CPlugInItem ( CString ln, CString cat, CString fname ) {SetPlugInItem ( ln, cat, fname );} ;
~CPlugInItem () {} ;
void SetPlugInItem ( CString LName, CString Cat, CString filname ) {
csLongName = LName ;
csCategory = Cat ;
csFilter = filname ;
} ;
CString LongName () { return csLongName ; } ;
CString Category () { return csCategory ; } ;
CString Filter () { return csFilter ; } ;
} ;
CPtrList PlugInList ;
CComboBox m_ffFilter;
extern "C" {
PIIMENUMCALLBACKPROC enumProc(LPSTR ln, LPSTR fn, LPSTR ct, LONG lParam )
{
CPtrList * pList = (CPtrList*)lParam ;
CPlugInItem * pItem = new CPlugInItem( ln, ct, fn ) ;
pList->AddTail ( pItem ) ;
return (PIIMENUMCALLBACKPROC) TRUE ;
}
}
ImgPlugInEnumerate((PIIMENUMCALLBACKPROC)enumProc, IM_PI_FILTER , (LONG)&PlugInList);
// populate the Plug-In drop down list
if ( PlugInList->Count() ) {
POSITION pos ;
CPlugInItem * pItem ;
for ( pos = PlugInList.GetHeadPosition() ; pos ; ) {
pItem = (CPlugInItem*)PlugInList.GetNext( pos ) ;
if ( pItem ) {
idx = m_ffFilter.InsertString ( -1, pItem->LongName() ) ;
m_ffFilter.SetItemDataPtr ( idx, pItem ) ;
}
}
}
Copyright 2008 Data Techniques, Inc. All Rights Reserved