The class query methods are used to define the properties of an object class. You would normally override these methods to define the unique properties of the class object. For example, you would override wpclsQueryTitle to provide a unique title for your object class. If you were defining a class called MyFolder, as a subclass of WPFolder, you might supply the following method to make the default title for all instances (including the template) of the MyFolder object "My Folder".

PSZ  SOMLINK myfdrM_wpclsQueryTitle(M_MyFolder *self)
{
  M_MyFolderMethodDebug("M_MyFolder","myfdrM_wpclsQueryTitle");
  return ("My Folder");
}

If you want to provide a unique icon for all instances of your class, you would override wpclsQueryIconData, as shown in the following sample code:

ULONG SOMLINK myfdrM_wpclsQueryIconData(M_MyFolder *self,
                                        PICONINFO pIconInfo)

{
  M_MyFolderMethodDebug("M_MyFolder","myfdrM_wpclsQueryIconData");
  if (pIconInfo)
  {
    /*
     *  vhmod is a global variable containing the
     *  module handle for your .DLL
     *  IDP_MyFolder is the resource number for the class icon
     */
    pIconInfo->fFormat = ICON_RESOURCE;
    pIconInfo->hmod    = vhmod;
    pIconInfo->resid   = IDP_MyFolder;
  }
  return (sizeof(ICONINFO));
}

If your class is a subclass of WPFolder (as in the above example) and you want to provide an animation icon, that is the icon that is displayed when an instance of your folder object is opened, you would override wpclsQueryIconDataN, as shown in the following sample code:

ULONG SOMLINK fdrM_wpclsQueryIconDataN(M_MyFolder *self,
                                       PICONINFO pIconInfo,
                                       ULONG ulIconIndex)

{
  ULONG ulReturn;

  M_MyFolderMethodDebug("M_MyFolder","myfdrM_wpclsQueryIconDataN");
  switch (ulIconIndex)
  {
    case 0:
    /* Return the information for the closed folder icon */
    ulReturn = _wpclsQueryIconData(self,pIconInfo);
    break;
    case 1:
    /* Return the information for the open folder icon */
    if (pIconInfo)
    {
      pIconInfo->fFormat = ICON_RESOURCE;
      pIconInfo->hmod    = vhmod;
      pIconInfo->resid   = IDP_MyFolder2;
    }
    ulReturn = sizeof(ICONINFO);
    break;

    default:
    /* Invalid index value specified */
    ulReturn = 0;
  }
  return (ulReturn);
}


[Back] [Next]