Index: /trunk/classes/c/c_image/cwimage.c
===================================================================
--- /trunk/classes/c/c_image/cwimage.c	(revision 59)
+++ /trunk/classes/c/c_image/cwimage.c	(revision 59)
@@ -0,0 +1,2470 @@
+
+/*
+ *  This file was generated by the SOM Compiler.
+ *  Generated using:
+ *     SOM incremental update: 2.47
+ */
+
+
+/*
+ * (C) Chris Wohlgemuth 2002-2004
+ *
+ */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ */          
+/*
+ * If you need another license for your project/product (commercial,
+ * noncommercial, whatever) contact me at
+ * 
+ * http://www.os2world.com/cdwriting
+ * http://www.geocities.com/SiliconValley/Sector/5785/
+ *
+ */
+/*
+ *  This file was generated by the SOM Compiler and Emitter Framework.
+ *  Generated using: 
+ *      SOM Emitter emitctm: 2.42
+ */
+
+#ifndef SOM_Module_cwimage_Source
+#define SOM_Module_cwimage_Source
+#endif
+#define CWImage_Class_Source
+#define M_CWImage_Class_Source
+
+#define INCL_DOS
+#define INCL_DOSSEMAPHORES
+#define INCL_DOSERRORS
+#define INCL_GPI
+#define INCL_PM
+#define INCL_MMIOOS2
+#include <os2.h>
+#include <stdio.h>
+#include "mmioos2.h"
+#include "cwimage.ih"
+#include "mmres.h"
+#include "except.h"
+#include "cwaudioinc.h"
+
+#include "sys_funcs.h"
+
+//#define DEBUG
+
+char notImplementedMsg[]= {"\nMethod not available while processing file %s: %s, file %s, around line %d.\n"};
+
+/* Set some default titles */
+PSZ pszImageColTitles[NUM_IMAGE_DETAILS_FIELDS]= {"Width", "Height", "Depth", "Format"};
+
+char chrWidth[SIZE_TITLE]="";
+char chrHeight[SIZE_TITLE]="";
+char chrDepth[SIZE_TITLE]="";
+char chrFormat[SIZE_TITLE]="";
+
+CLASSFIELDINFO cfiImageFieldInfo[NUM_IMAGE_DETAILS_FIELDS];
+
+/* Some methods are not yet implemented */
+#define NOT_IMPLEMENTED  DosBeep(1000, 100);\
+                         DosBeep(2000, 100);\
+                         DosBeep(3000, 100);\
+                         DosBeep(4000, 100);\
+                         DosBeep(3000, 100);\
+                         DosBeep(2000, 100);\
+                         DosBeep(1000, 100);\
+                         SysWriteToTrapLog(notImplementedMsg,\
+                                           _wpQueryTitle(somSelf), __FUNCTION__, __FILE__, __LINE__);
+
+
+extern HAB globalHab;
+HWND hwndCreateBMP; /* Object window for small bitmap creation */
+HWND g_hwndDeleteBMP; /* Object window for bitmap deletion */
+
+extern char classDLLPath[CCHMAXPATH];
+extern char chrHelpLibrary[CCHMAXPATH];
+PMMFORMATINFO g_pmmFormatInfoArray=NULLHANDLE;
+LONG          lNumIOProcs=0;/* Needed to know how many convert menus we have */
+
+char chrMMImageKnownExt[320]={0};/* Array holding the extensions we have a class for e.g. JPG. This
+                                    array will be filled using an external REXX script. Space for
+                                    80 ext should be enough for now (4 bytes per ext e.g.: "JPG "<- note the space) */
+char chrMMImageExt[200]={0};/* Array holding the extensions for wpclsQueryInstanceFilter(). Will be
+                               filled during processing of wpclsInitData() */
+
+
+ULONG launchPMProg(PSZ pszTitle, PSZ wrapperExe, PSZ parameters,  WPObject *thisPtr, ULONG ulView);
+
+BOOL getMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd);
+ULONG messageBox( char* text, ULONG ulTextID , LONG lSizeText,
+                  char* title, ULONG ulTitleID, LONG lSizeTitle,
+                  HMODULE hResource, HWND hwnd, ULONG ulFlags);
+
+void writeLog(char* chrFormat, ...);
+HMODULE queryResModuleHandle(void);
+HMODULE queryModuleHandle(void);
+PSZ queryModuleName(void);
+
+BOOL getBmpInfoHeader(PBITMAPINFOHEADER2  bmpih2, PSZ pszFileName, char* procName, ULONG ulLength, BOOL * bNoIOProcAvailable);
+HBITMAP loadBitmap ( PSZ pszFileName, PBITMAPINFOHEADER2 pBMPInfoHeader2);
+HBITMAP createNewBitmap ( HBITMAP hbm,
+                          PBITMAPINFOHEADER2 pBmpInfoHeader2,
+                          ULONG ulWidth, 
+                          ULONG ulHeight, 
+                          BOOL* pbQuitEarly);
+
+ULONG showMsgBox2(ULONG ulIDTitle, ULONG ulIDText, HMODULE hModule, ULONG ulFlag);
+ULONG showMsgBox(ULONG ulIDTitle, ULONG ulIDText, HMODULE hModule);
+BOOL cwObjectIsOnCD(WPObject * somSelf);
+BOOL getStringFromRexxScript(PSZ rexxFile, char* chrResult, ULONG ulSize);
+
+BOOL mmclsCreateTheDefaultTemplate(M_WPObject *somSelf, 
+                                   WPObject* Folder);
+
+MRESULT menuInsertMenuSeparator(HWND hwndMenu, HWND hwndSubMenu, SHORT sPosition );
+
+/* 
+   This Proc creates the small bitmaps for display on a separate thread.
+   It's used indirectly used by the lighttable folder when an attempt to
+   paint the bitmap is made. It will also generate bmps when WPS-wizard wants
+   to paint icons in the container.
+ */
+MRESULT EXPENTRY createBMPObjectProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
+{
+
+  switch (msg)
+    {
+    case WM_APPTERMINATENOTIFY:
+      {
+        switch(SHORT2FROMMP(mp2))
+          {
+          case ACKEY_CREATE_SMALLBITMAP:
+            {
+              BOOL bLoaded=FALSE;
+              HBITMAP hbm;
+              PCREATEBMPINFO pCreateBMP=PVOIDFROMMP(mp1);
+              MMImageData *somThis;
+              WPObject *wpObject;
+              PMINIRECORDCORE pmrcToRefresh;
+
+              if(!pCreateBMP)
+                return (MRESULT) FALSE;
+#ifdef DEBUG
+              SysWriteToTrapLog("In %s, line %d\n", __FUNCTION__, __LINE__);
+#endif
+
+              if(!somIsObj(pCreateBMP->wpObject))
+                return (MRESULT) FALSE;
+
+              /* 
+                 V0.2.8, CW 2004/11/01 
+                 
+                 It's possible that a lot of requests are issued to this thread while opening a folder.
+                 These are qeued and in the meanwhile the user may have closed the folder.
+                 */
+              if(!WinIsWindow(globalHab, pCreateBMP->hwndCnr))
+                return MRFALSE;
+
+
+              TRY_LOUD(BITMAP_OBJECT) {
+                somThis  = MMImageGetData(pCreateBMP->wpObject);
+                pmrcToRefresh=pCreateBMP->pmrcToRefresh;
+                for(;;) {
+                  RECTL rectl, rectl2;
+                  if(WinSendMsg(pCreateBMP->hwndCnr, CM_QUERYVIEWPORTRECT, MPFROMP(&rectl2), MPFROM2SHORT(CMA_WORKSPACE, FALSE))) {
+
+                    /*
+                      V0.2.8 CW 2004/11/01
+
+                      Only create small bitmaps for icons currently visible in the container. This is useful if the
+                      user scrolls a folder and not every small bitmap is yet created.
+                     */
+                    if(pmrcToRefresh->ptlIcon.y+40 < rectl2.yBottom || pmrcToRefresh->ptlIcon.y > rectl2.yTop)
+                      break;
+                    if(pmrcToRefresh->ptlIcon.x+40 < rectl2.xLeft || pmrcToRefresh->ptlIcon.x > rectl2.xRight)
+                      break;
+                  }/* WinSendMsg() */
+
+                  _wpLockObject(pCreateBMP->wpObject);
+                  
+                  /* Check if in the meantime the bitmap was created */
+                  if(!_hBitmapSmall) {
+                    /* 
+                       FIXME:
+                       
+                       Not threadsafe!!!
+                       
+                       Use a private work alike for wpQueryBitmapHandle instead???
+                       
+                       Check if bitmap data already loaded. Keep the info so we don't discard the bitmap later on. Another
+                       function may have requested the bitmap before. During wpQueryBitmapHandle() a normal size bitmap
+                       is always created. We don't want to have memory wasted by the big one so it's discarded afterwards.
+                       Not perfect, but works at the moment. Will be revamped later with automatic bitmap deletion. */
+                    if(_hBitmap)
+                      bLoaded=TRUE;
+                    
+                    if(_wpQueryBitmapHandle(pCreateBMP->wpObject, 
+                                            &hbm, 
+                                            NULLHANDLE,
+                                            pCreateBMP->ulWidth, 
+                                            pCreateBMP->ulHeight, 
+                                            0, /* ulFlags*/ 
+                                            0, 
+                                            NULLHANDLE)) {
+                      _hBitmapSmall=hbm;
+                      _ulSizeSmallBitmap=pCreateBMP->ulHeight;
+                      if(!bLoaded) {
+                        /* The bitmap wasn't loaded so discard it now, we don't need it any more as we have
+                           the small one. */
+                        GpiDeleteBitmap(_hBitmap);
+                        _hBitmap=NULLHANDLE;
+                      }
+                    }/* _wpQueryBitmapHandle() */
+                  }
+                  if(WinIsWindow(globalHab, pCreateBMP->hwndCnr) && pmrcToRefresh)
+                    //    WinPostMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION));
+                    WinSendMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION));
+                  
+                  _wpUnlockObject(pCreateBMP->wpObject);
+                  break;
+                }/* for */
+              }/* Try */
+              CATCH(BITMAP_OBJECT)
+                {
+                  SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d.\n",
+                                    __FUNCTION__, __FILE__, __LINE__);
+                  _wpUnlockObject(pCreateBMP->wpObject); /* If we trapped in wpUnlockObject(), we will have a problem here... */
+                } END_CATCH;
+                //        WinSendMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION));
+                //   _wp_FreeMem(wpObject, (PBYTE)pCreateBMP);
+                free((PBYTE)pCreateBMP);
+
+                return (MRESULT) FALSE;
+            }/* case ACKEY_CREATE_SMALLBITMAP */
+          case ACKEY_QUERY_BITMAPINFO:
+            {
+              PCREATEBMPINFO pCreateBMP=PVOIDFROMMP(mp1);
+              MMImageData *somThis;
+
+              if(!pCreateBMP)
+                return (MRESULT) FALSE;
+              if(!somIsObj(pCreateBMP->wpObject))
+                return (MRESULT) FALSE;
+
+              TRY_LOUD(BITMAPIH_OBJECT) {          
+                somThis  = MMImageGetData(pCreateBMP->wpObject);
+                                
+                /* Check if in the meantime the bitmap was created */
+                if(!_pBmpInfoHeader2) {
+                  _pBmpInfoHeader2=_wpQueryBitmapInfoHeader(pCreateBMP->wpObject);
+                  /* Make sure the image size is cached in the EA */
+                  if(_pBmpInfoHeader2)
+                    _wpSaveDeferred(pCreateBMP->wpObject);
+                }
+              }/* Try */
+              CATCH(BITMAPIH_OBJECT)
+                {
+                  SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d while getting BMPINFOHEADER.\n",
+                                    __FUNCTION__, __FILE__, __LINE__);
+                } END_CATCH;
+              return (MRESULT) FALSE;
+            }
+          default:
+            break;
+          }/* switch(SHORT2FROMMP(mp2)) */
+        return (MRESULT) FALSE;
+      }/* case WM_APPTERMINATENOTIFY */
+    default:
+      break;
+    }
+  return WinDefWindowProc( hwnd, msg, mp1, mp2);
+}
+
+/*
+
+  This thread is started in cwimgM_wpclsInitData(M_MMImage *somSelf). It will create small bitmaps and reads
+  in the BITMAPINFOHEADER.
+
+*/
+void _Optlink createBMPThreadFunc (void *arg)
+{
+
+  HAB  hab;
+  HMQ  hmq;
+  QMSG qmsg;
+  
+  hab=WinInitialize(0);
+  if(hab) {
+    hmq=WinCreateMsgQueue(hab, 50);
+    if(hmq) {
+      hwndCreateBMP=WinCreateWindow(HWND_OBJECT,WC_STATIC,"coverObj",0,0,0,0,0,NULLHANDLE,HWND_BOTTOM,13343,NULL,NULL);
+      if(hwndCreateBMP) {
+        WinSubclassWindow(hwndCreateBMP,&createBMPObjectProc);
+        /* Window created. */
+        while(WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))
+          WinDispatchMsg(hab,&qmsg);
+        WinDestroyWindow(hwndCreateBMP);
+      }
+      WinDestroyMsgQueue(hmq);
+    }
+    WinTerminate(hab);
+  }
+}
+
+ULONG ulNumBMPDelete=0;
+#define IMGWM_DELETEBITMAP WM_USER+10
+
+MRESULT EXPENTRY deleteBMPObjectProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
+{
+
+  switch (msg)
+    {
+    case IMGWM_DELETEBITMAP:
+      {
+        MMImage* somSelf=PVOIDFROMMP(mp1);
+        if(somIsObj(somSelf)) {
+#if 0
+          if(!_wpFindUseItem(somSelf, USAGE_RECORD, NULLHANDLE)) {
+            _cwmmFreeBitmaps(somSelf);
+            //DosBeep(5000, 20);
+          }
+#endif
+          // DosBeep(5000, 10);
+          _cwmmFreeBitmaps(somSelf);
+          //SysWriteToTrapLog("Object is locked: %d\n", _wpIsLocked(somSelf));
+          /* Decrease delete request count */
+          ulNumBMPDelete--;
+          //    SysWriteToTrapLog("Num requests left: %d\n", ulNumBMPDelete);
+        }
+        return FALSE;
+        
+      }
+    default:
+      break;
+    } /* msg */
+  return WinDefWindowProc( hwnd, msg, mp1, mp2);
+}
+
+#define BMP_QUEUE_SIZE 100
+#define BMP_DEL_UPPER  80 /* If number of delete request reaches this the thread is unlocked */
+#define BMP_DEL_LOWER  50 /* After reaching this number of requests the thread goes back to sleep until the timeout comes. */
+#define BMP_DEL_WAITTIME 10000 /* Default sleeptime of the thread thus checking for new delete requests with this interval */
+#define BMP_DEL_MINAGE   8000 /* Min age of message before bitmaps are actually destroyed in the background */
+
+HEV hevDeleteBMP;
+
+/*
+
+  This thread is started in cwimgM_wpclsInitData(M_MMImage *somSelf).
+
+  This is the poor man's bitmap deletion thread. It wakes up every BMP_DELWAITTIME ms and
+  deletes bitmaps which are at least BMP_DELMINAGE ms not used.
+
+  It will not reorder messages and will not remove duplicates (hence poor man's). So the
+  oldest delete request will be fullfilled even if in the meantime the bitmap was used and
+  a new request issued. Anyway bitmaps will NOT be destroyed, if the file is inserted into a
+  container! But overall it's way better than immediately delete BMPs after use because when
+  closing a folder maybe dozens of bitmaps must be removed at once.
+
+*/
+void _Optlink deleteBMPThreadFunc (void *arg)
+{
+
+  HAB  hab;
+  HMQ  hmq;
+  QMSG qmsg;
+  BOOL bSemCreated;
+  ULONG ulWaitTime=BMP_DEL_WAITTIME;
+
+  hab=WinInitialize(0);
+  if(hab) {
+    hmq=WinCreateMsgQueue(hab, BMP_QUEUE_SIZE);
+    if(hmq) {
+      g_hwndDeleteBMP=WinCreateWindow(HWND_OBJECT,WC_STATIC,"delBMPObj",0,0,0,0,0,NULLHANDLE,HWND_BOTTOM,13343,NULL,NULL);
+      if(g_hwndDeleteBMP) {
+        WinSubclassWindow(g_hwndDeleteBMP,&deleteBMPObjectProc);
+        /* Lower priority to idle -5. Memory clean up shouldn't disturb the user */
+        //    DosSetPriority(PRTYS_THREAD, PRTYC_IDLETIME, -5, 0);
+
+        /* Create event semaphore. This thread normally waits on this semaphore for several minutes. After the
+           timeout it fetches a pending msg and deletes the bitmap. If a lot of deletion request are sent, the
+           sending function posts the semaphore before the timeout and the oldest requests are handled immediately.
+
+           The semaphore is reset when created.
+           */
+        bSemCreated=!DosCreateEventSem(NULL, &hevDeleteBMP, 0, FALSE);
+        /* Window created. Wait for msg. */
+        while(WinGetMsg(hab,&qmsg,(HWND)NULL,0,0)) {
+          BOOL bQuit = FALSE;
+
+          //    SysWriteToTrapLog("\n\nGot first msg...\n");
+
+          /* First message is always dispatched no matter how old */
+          WinDispatchMsg(hab,&qmsg);
+
+          if(bSemCreated) {
+            ULONG ulPostCount;
+            BOOL bTimeError=FALSE;
+
+            //SysWriteToTrapLog("Waiting on semaphore...\n");
+
+            if(DosWaitEventSem(hevDeleteBMP, ulWaitTime)==ERROR_TIMEOUT) {
+              ULONG ulTime=WinGetCurrentTime(hab);
+
+              //SysWriteToTrapLog("Sem timeout\n");
+
+              //ulPostCount=0; /* only debug */
+              /* Check for pending messages */
+              while(WinPeekMsg(hab,&qmsg,(HWND)NULL,0,0, PM_NOREMOVE)) {
+
+                //ulPostCount++;
+                //SysWriteToTrapLog("  Have msg %d\n", ulPostCount);
+                
+                /*
+                  Check for system msgs and dispatch them.
+                 */
+                if(qmsg.msg!=IMGWM_DELETEBITMAP) {
+                  /* Get the message and quit if it's WM_QUIT (shouldn't happen though) */
+                  if((bQuit=!WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))==TRUE)
+                    break;
+                  /* else dispatch and continue loop */
+                  WinDispatchMsg(hab,&qmsg);
+                  continue;
+                }
+                bTimeError=FALSE;
+                if(ulTime-qmsg.time > BMP_DEL_MINAGE) {
+                  /* The message is old enough so get it and dispatch */
+                  //  SysWriteToTrapLog("  time > BMP_DEL_MINAGE\n");
+                  WinGetMsg(hab,&qmsg,(HWND)NULL,0,0);
+                  WinDispatchMsg(hab,&qmsg);
+                  //  SysWriteToTrapLog("Dispatched, next msg?\n");
+                  ulWaitTime=BMP_DEL_WAITTIME;
+                }
+                else {
+                  /* Message isn't old so wait until wait time is really over */
+                  //  SysWriteToTrapLog("  time to short!!!\n");
+                  ulWaitTime=BMP_DEL_WAITTIME-(ulTime-qmsg.time);
+                  bTimeError=TRUE;
+                  break;
+                }
+                //                SysWriteToTrapLog("Back to inner while...\n");
+              }/* while */
+              /*
+                FIXME:
+
+                Make ist right and robust!
+
+                Set counter to 0 if all messages are handled. This isn't correct, because it's not thread safe
+                but doesn't matter that much. In the worst case some messages are dispatched later but
+                it's not system critical at all. In wpUninitData() the bitmaps are deleted anyway.
+                */
+              if(!bTimeError)
+                ulNumBMPDelete=0; /* No messages in queue (but maybe another thread is just adding them...) */
+            } /* semaphore timeout */
+            else
+              {
+                /*
+                  queue is almost full. The semaphore was posted by the function so
+                  dispatch messages faster. 
+                 */
+                int a=0;
+                //                SysWriteToTrapLog(" --Semaphore posted\n");
+                while((bQuit=!WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))==FALSE 
+                      && a < BMP_DEL_UPPER-BMP_DEL_LOWER) {
+                  //     SysWriteToTrapLog(" -- Got message, dispatching it...\n");
+                  if(qmsg.msg==IMGWM_DELETEBITMAP)
+                    a++;
+                  WinDispatchMsg(hab,&qmsg);
+                  //    SysWriteToTrapLog("--Dispatching msg %d\n", a);
+                }/* while */
+                ulWaitTime=BMP_DEL_WAITTIME;
+              }
+            //  if(WinQueryQueueInfo(hmq, &mqi, sizeof(MQINFO)))
+            //     SysWriteToTrapLog("WinQueryQueueInfo succeeded.\n");
+            //  if(!mqi.cmsgs)
+            //  ulNumBMPDelete=mqi.cmsgs;
+            //      SysWriteToTrapLog("Now resetting event semaphore\n");
+
+            DosResetEventSem(hevDeleteBMP, &ulPostCount);
+          }/* bSemCreated */
+          if(bQuit)
+            break;
+        }/* while() */
+
+        DosCloseEventSem(hevDeleteBMP);
+        WinDestroyWindow(g_hwndDeleteBMP);
+      }
+      WinDestroyMsgQueue(hmq);
+    }
+    WinTerminate(hab);
+  }
+}
+
+void sendDeleteBMPMsg(MMImage* somSelf)
+{
+  PUSEITEM pui;
+  /*
+    Unfortunately only bitmaps for real files are currently deleted. When using links in folders
+    the lock counter isn't touched so we don't get a notification.
+    _wpUnlockObject isn't called when links are going dormant (do they?) after closing the links folder.
+
+    BTW XWorkplace (V1.0.0) keeps every object locked
+    after first touching it and NEVER completely unlocks it!
+    */
+  //  SysWriteToTrapLog("Out side - %s %d\n", __FUNCTION__, ulNumBMPDelete);
+  if((pui=_wpFindUseItem(somSelf, USAGE_RECORD, NULLHANDLE))==NULLHANDLE) {
+    /* Check if queue is full. If yes post semaphore so the other thread cleans up. */
+    if(ulNumBMPDelete> BMP_DEL_UPPER) {
+      //        SysWriteToTrapLog("   ---> Posting semaphore...\n");
+      DosPostEventSem(hevDeleteBMP);
+      /* Yield cpu so the delete thread may run */
+      DosSleep(20);
+      /* Thread isn't fast enough so delete the bitmap directly */
+      if(ulNumBMPDelete>BMP_QUEUE_SIZE-7) {
+        _cwmmFreeBitmaps(somSelf);
+        return;
+      }
+    }
+    ulNumBMPDelete++;
+    //    SysWriteToTrapLog("%s %d\n", __FUNCTION__, ulNumBMPDelete);
+    WinPostMsg(g_hwndDeleteBMP, IMGWM_DELETEBITMAP, MPFROMP(somSelf), MPFROM2SHORT(0, ACKEY_CREATE_SMALLBITMAP));
+  }
+}
+
+MRESULT EXPENTRY imageInfoDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
+{
+  MMImage *cwImage;
+
+  switch(msg) {
+  case WM_INITDLG :
+    cwImage=(MMImage*)LONGFROMMP(mp2);
+    if(somIsObj(cwImage)) {
+      MMImageData *somThis = MMImageGetData(cwImage);
+
+      PBITMAPINFOHEADER2 pbmpih2;
+
+      if((pbmpih2=(PBITMAPINFOHEADER2)_wpQueryBitmapInfoHeader(cwImage))!=NULLHANDLE)
+        {
+          char fName[CCHMAXPATH];
+          char chrTemplate[100];
+
+          if(pbmpih2->cbFix==sizeof(BITMAPINFOHEADER2)) {
+            if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 
+                       queryResModuleHandle(), hwnd))
+              strcpy(chrTemplate, "%d Pixel");
+            sprintf(fName, chrTemplate, pbmpih2->cx);
+            WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEWIDTH),fName);
+            
+            sprintf(fName, chrTemplate, pbmpih2->cy);
+            WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEHEIGHT),fName);
+
+            if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 
+                           queryResModuleHandle(), hwnd))
+              strcpy(chrTemplate, "%d Bit");            
+            sprintf(fName, chrTemplate, pbmpih2->cBitCount);
+            WinSetWindowText(WinWindowFromID(hwnd, IDST_COLORDEPTH),fName);
+          }
+          else if(pbmpih2->cbFix==sizeof(BITMAPINFOHEADER)) {
+            /* We shouldn't get a BITMAPINFOHEADER here but who knows...*/
+            PBITMAPINFOHEADER pbmpih=(PBITMAPINFOHEADER)pbmpih2;
+            if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 
+                           queryResModuleHandle(), hwnd))
+              strcpy(chrTemplate, "%d Pixel");
+            sprintf(fName, chrTemplate,pbmpih->cx);
+            WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEWIDTH),fName);
+            
+            sprintf(fName, chrTemplate, pbmpih->cy);
+            WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEHEIGHT),fName);
+
+            if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 
+                           queryResModuleHandle(), hwnd))                        
+              strcpy(chrTemplate, "%d Bit");
+            sprintf(fName, chrTemplate, pbmpih->cBitCount);
+            WinSetWindowText(WinWindowFromID(hwnd, IDST_COLORDEPTH),fName);
+          }
+          
+          WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEFORMAT),_chrIOProcName);
+        }
+    }/* somIsObj() */
+    return (MRESULT)TRUE;
+    /* This prevents switching the notebook page behind the open folder */
+    case WM_WINDOWPOSCHANGED:
+      {
+        MRESULT mr;
+
+        if(WinQueryFocus(HWND_DESKTOP)!=
+           WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT)) {
+          mp2=MPFROMLONG(LONGFROMMP(mp2)|0x80000);/*AWP_ACTIVATE 0x00080000L*/
+          mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
+          return mr;  
+        }
+        break;
+      }
+    case WM_FOCUSCHANGE:
+      {
+        if(!SHORT1FROMMP(mp2)) {
+          if(HWNDFROMMP(mp1)==hwnd) {
+            MRESULT mr;
+
+            mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
+            WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), 
+                       WM_SETFOCUS, MPFROMHWND(hwnd), (MPARAM)TRUE);
+            return mr;
+          }
+        }
+        break;
+      }
+    case WM_DESTROY:
+      /* The notebook closes and gets destroyed */
+      /* Set focus to desktop to prevent PM freeze */
+      WinSetFocus(HWND_DESKTOP, HWND_DESKTOP);
+      break;
+  default:
+    break;
+  }
+  return WinDefDlgProc(hwnd, msg, mp1, mp2);
+}
+
+/*!*******************************************************/
+/*                                                       */
+/* @@DESC                                                */
+/*                                                       */
+/* This instance method is called to allow the object    */
+/* to add the image information page to its Settings     */
+/* notebook.                                             */
+/*                                                       */
+/* @@USAGE                                               */
+/*                                                       */
+/* This method must only be called from within an        */
+/* override of wpAddSettingsPages().                     */
+/*                                                       */
+/* @@PARAM                                               */
+/*                                                       */
+/* MMImage *somSelf input                                */
+/*                                                       */
+/* Pointer to the object on which the method is being    */
+/* invoked.                                              */
+/* :p.                                                   */
+/* Points to an object of class :hp2.MMImage:ehp2..      */
+/*                                                       */
+/* @@PARAM                                               */
+/*                                                       */
+/* HWND hwndNotebook input                               */
+/*                                                       */
+/* Settings notebook handle.                             */
+/*                                                       */
+/* @@OVERRIDE                                            */
+/*                                                       */
+/* This method should always be overridden in order to   */
+/* remove or replace the image information page from     */
+/* the object's Settings notbook.                        */
+/* :p.                                                   */
+/* To remove the page from the Settings notebook, the    */
+/* override method should return                         */
+/* :hp1.SETTINGS_PAGE_REMOVED:ehp1. without calling the  */
+/* the parent method. To replace the page with another   */
+/* page, the override method should call the             */
+/* wpInsertSettingsPAge method without calling the       */
+/* parent method.                                        */
+/*                                                       */
+/* @@RETURNS                                             */
+/*                                                       */
+/* ULONG rc                                              */
+/*                                                       */
+/* :parml compact tsize=15 break=none.                   */
+/* :pt.0:pd.Error occurred                               */
+/* :pt.PageId :pd.Identifier for the inserted page.      */
+/* :eparml.                                              */
+/*                                                       */
+/*!!******************************************************/
+SOM_Scope ULONG  SOMLINK cwimg_cwmmAddImageInformationPage(MMImage *somSelf, 
+                                                           HWND hwndNotebook)
+{
+  PAGEINFO pageinfo;
+  char pageName[100];
+
+  /*    MMImageData *somThis = MMImageGetData(somSelf);*/
+    MMImageMethodDebug("MMImage","cwimg_cwmmAddImageInformationPage");
+
+  //Clear the pageinfo structure
+  memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
+  //Fill the pageinfo structure
+  pageinfo.cb = sizeof(PAGEINFO);
+  pageinfo.hwndPage = NULLHANDLE;
+  pageinfo.usPageStyleFlags = BKA_MAJOR | BKA_STATUSTEXTON;
+  pageinfo.usPageInsertFlags = BKA_FIRST;
+  //We want page numbers
+  pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
+  //The dialog procedure for this page
+  pageinfo.pfnwp = imageInfoDlgProc;
+  //The resource DLL
+  pageinfo.resid = queryResModuleHandle();
+  //The ID of the dialog template
+  pageinfo.dlgid = IDDLG_IMAGEINFOPAGE;
+  //We need a pointer to our WPS-object in the dialog procedure
+  //to call class functions
+  pageinfo.pCreateParams = somSelf;
+  //The ID of the help panel for this page
+  //pageinfo.idDefaultHelpPanel = IDDLG_GENERAL2PAGE;
+
+  //Tell the WPS the help library name
+  pageinfo.pszHelpLibraryName = NULLHANDLE;
+  //We have a major tab so we need a name
+  /* pageName: "ISO filesystem" */
+  if(!getMessage(pageName, IDSTR_IMAGEINFOPAGENAME, sizeof(pageName),  queryResModuleHandle(), hwndNotebook))
+    strcpy(pageName, "~Image information");
+  pageinfo.pszName = pageName;
+  //Insert the page into the settings notebook
+  return _wpInsertSettingsPage(somSelf,hwndNotebook,&pageinfo);
+
+}
+
+/*!*******************************************************/
+/*                                                       */
+/* @@DESC                                                */
+/*                                                       */
+/* This instance method is called to get a small bitmap  */
+/* representing the image of this object.                */
+/*                                                       */
+/* @@USAGE                                               */
+/*                                                       */
+/* This method is called by a folder painting procedure  */
+/* when the objects image must be drawn as an icon in    */
+/* a folder. For example the lighttable folder uses this */
+/* to get the bitmaps of image files.                    */
+/* :p.                                                   */
+/* This method is specifically designed for the mentioned*/
+/* purpose. It is called with a pointer to the objects   */
+/* container record and the container handle. If the     */
+/* needed bitmap handle isn't already created, this      */
+/* will be done on a separate thread and afterwards the  */
+/* objects record will automatically updated with the    */
+/* new image. The caller doesn't has to wait for this and*/
+/* has not to repeat the call if a NULLHANDLE is         */
+/* returned.                                             */
+/*                                                       */
+/* @@PARAM                                               */
+/*                                                       */
+/* MMImage *somSelf input                                */
+/*                                                       */
+/* Pointer to the object on which the method is being    */
+/* invoked.                                              */
+/* :p.                                                   */
+/* Points to an object of class :hp2.MMImage:ehp2..      */
+/*                                                       */
+/* @@PARAM                                               */
+/*                                                       */
+/* ULONG ulSize      input                               */
+/*                                                       */
+/* Size of the bitmap.                                   */
+/*                                                       */
+/* @@PARAM                                               */
+/*                                                       */
+/* PMINIRECORDCORE pmrcToRefresh input                   */
+/*                                                       */
+/* The objects container record. This record will        */
+/* automatically be refreshed when the bitmap            */
+/* isn't already created.                                */
+/*                                                       */
+/* @@PARAM                                               */
+/*                                                       */
+/* HWND hwndCnr input                                    */
+/*                                                       */
+/* The container holding the object. After creating the  */
+/* bitmap the icon of the object in this container will  */
+/* be redrawn.                                           */
+/*                                                       */
+/* @@OVERRIDE                                            */
+/*                                                       */
+/* This method is generally not overridden.              */
+/*                                                       */
+/* @@RETURNS                                             */
+/*                                                       */
+/* HBITMAP hBitmap                                       */
+/*                                                       */
+/* A bitmap handle of a small bitmap usable to be drawn  */
+/* as an objects representation in a folder.             */
+/*                                                       */
+/*!!******************************************************/
+SOM_Scope HBITMAP  SOMLINK cwimg_cwmmQuerySmallBitmapHandle(MMImage *somSelf, 
+                                                            ULONG ulSize, 
+                                                            PMINIRECORDCORE pmrcToRefresh, 
+                                                            HWND hwndCnr)
+{
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_cwmmQuerySmallBitmap");
+
+    //      SysWriteToTrapLog("In %s, line %d. ulSize: %d\n", __FUNCTION__, __LINE__, ulSize);
+
+
+#ifdef DEBUG
+      SysWriteToTrapLog("In %s, line %d. somself: 0x%x, ulSize: 0x%x, mrc: 0x%x, hwndCnr: 0x%x.\n",
+                        __FUNCTION__, __LINE__, somSelf, ulSize, pmrcToRefresh, hwndCnr);
+
+
+      //SysWriteToTrapLog("In %s, line %d. ulSize: 0x%x, mrc: 0x%x, hwndCnr: 0x%x, _bNoIOProcAvailable: 0x%x, somSelf: 0x%x,  somThis: 0x%x.\n",
+      //                __FUNCTION__, __LINE__, ulSize, pmrcToRefresh, hwndCnr, _bNoIOProcAvailable, somSelf, somThis);
+#endif
+
+      if(_bNoIOProcAvailable)
+        return NULLHANDLE; /* No IO-proc for this image format. Don't try again in the future. 
+                            This var is set if we trapped during reading. */
+
+      if(!_wpIsObjectInitialized(somSelf)) {
+#ifdef DEBUG
+      SysWriteToTrapLog("In %s, line %d Object is not initialized\n", __FUNCTION__, __LINE__);
+#endif
+      return NULLHANDLE;
+      }
+#ifdef DEBUG
+      SysWriteToTrapLog("In %s, line %d\n", __FUNCTION__, __LINE__);
+#endif
+
+    if(ulSize<MAX_SIZE_SMALLBITMAP)
+      ulSize=MAX_SIZE_SMALLBITMAP;
+
+    if(ulSize>_ulSizeSmallBitmap)
+      {
+        if(_hBitmapSmall) {
+          GpiDeleteBitmap(_hBitmapSmall);
+          _hBitmapSmall=NULLHANDLE;
+        }
+      }
+
+    /* 
+       FIXME: use WinIsWindow() here?? 
+     */
+    if(!_hBitmapSmall && hwndCreateBMP) {
+      ULONG ulError;
+      PCREATEBMPINFO pCreateBMP;
+      _ulSizeSmallBitmap=0;
+
+      /* Allocate memory for small bitmap info for the thread */
+      //      if((pCreateBMP=(PCREATEBMPINFO)_wp_AllocMem(somSelf, sizeof(CREATEBMPINFO),&ulError))==NULLHANDLE)
+      if((pCreateBMP=(PCREATEBMPINFO)malloc( sizeof(CREATEBMPINFO)))==NULLHANDLE)
+        return NULLHANDLE;
+
+      pCreateBMP->ulWidth=ulSize;
+      pCreateBMP->ulHeight=ulSize;
+      pCreateBMP->wpObject=somSelf;
+      pCreateBMP->pmrcToRefresh=pmrcToRefresh;
+      pCreateBMP->hwndCnr=hwndCnr;
+
+#ifdef DEBUG
+      SysWriteToTrapLog("In %s, line %d. Sending msg to create thread.\n", __FUNCTION__, __LINE__);
+#endif
+
+      WinPostMsg(hwndCreateBMP, WM_APPTERMINATENOTIFY,MPFROMP(pCreateBMP), MPFROM2SHORT(0, ACKEY_CREATE_SMALLBITMAP));
+      free(pCreateBMP);
+      return NULLHANDLE;
+    }
+    /* Return statement to be customized: */
+    return _hBitmapSmall;
+}
+
+
+SOM_Scope void  SOMLINK cwimg_cwmmFreeBitmaps(MMImage *somSelf)
+{
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_cwmmFreeBitmaps");
+
+
+    if(_pBmpInfoHeader2) {
+      free(_pBmpInfoHeader2);
+      //  _wp_FreeMem(somSelf, _pBmpInfoHeader2);
+      _pBmpInfoHeader2=NULLHANDLE;
+      _chrIOProcName[0]=0;
+    }
+
+    if(_hBitmap) {
+      GpiDeleteBitmap(_hBitmap);
+      _hBitmap=NULLHANDLE;
+    }
+
+    _cwmmFreeSmallBitmap(somSelf);
+}
+
+/*
+ * The prototype for cwimg_cwmmFreeSmallBitmap was replaced by the following prototype:
+ */
+SOM_Scope void  SOMLINK cwimg_cwmmFreeSmallBitmap(MMImage *somSelf)
+{
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_cwmmFreeSmallBitmap");
+
+    /*
+      V0.2.8 CW 2004/11/01
+
+      Added serialization using the object semaphore
+
+
+    if(!_wpRequestObjectMutexSem(somSelf, 2000))
+      return;
+     */
+    if(_hBitmapSmall) {
+
+      GpiDeleteBitmap(_hBitmapSmall);
+      _hBitmapSmall=NULLHANDLE;
+      _ulSizeSmallBitmap=0;
+    }
+    //    _wpReleaseObjectMutexSem(somSelf);
+}
+
+/* New with V0.2.5, CW 2003/01/02 */
+
+/*
+ * SOM_Scope ULONG  SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 
+ *                                                   char** chrString, 
+ *                                                   ULONG ulSize, 
+ *                                                   int iWhich)
+ */
+
+/*
+ * The prototype for cwimg_cwmmQueryImageInfo was replaced by the following prototype:
+ */
+SOM_Scope ULONG  SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 
+                                                  char** chrString, 
+                                                  ULONG ulSize, 
+                                                  long iWhich)
+{
+  PBITMAPINFOHEADER2 pBmpInfoHdr2=NULLHANDLE;       
+  ULONG ulWidth, ulHeight, ulDepth;
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_cwmmQueryImageInfo");
+
+    pBmpInfoHdr2=(PBITMAPINFOHEADER2) _wpQueryBitmapInfoHeader(somSelf);
+
+    if(!pBmpInfoHdr2)
+      return 0;
+
+    if(pBmpInfoHdr2->cbFix==sizeof(BITMAPINFOHEADER2)) {
+      ulWidth=pBmpInfoHdr2->cx;
+      ulHeight=pBmpInfoHdr2->cy;
+      ulDepth=pBmpInfoHdr2->cBitCount;
+    }
+    else {
+      PBITMAPINFOHEADER pBmpInfoHdr=(PBITMAPINFOHEADER)pBmpInfoHdr2;
+          ulWidth=pBmpInfoHdr->cx;
+          ulHeight=pBmpInfoHdr->cy;
+          ulDepth=pBmpInfoHdr->cBitCount;
+    }
+    switch(iWhich)
+      {
+      case IDINFO_WIDTH:
+        return ulWidth;
+      case IDINFO_HEIGHT:
+        return ulHeight;
+      case IDINFO_BPP:
+        return ulDepth;
+      case IDINFO_FORMAT:
+        {
+          char *chr;
+          /* Image format */
+          if(!chrString)
+            return 0;
+          chr=*chrString;
+          strncpy(chr, _chrIOProcName, ulSize);
+          chr[ulSize-1]=0;
+          if(chr[0]==0)
+            return 0;
+          else
+            return 1;
+        }
+      default:
+        break;
+      }
+    return 0;
+}
+
+SOM_Scope void  SOMLINK cwimg_cwmmRequestBmpDeletion(MMImage *somSelf, 
+                                                     ULONG ulFlags)
+{
+  PUSEITEM pui;
+  BOOL bDeleteBmp=FALSE;
+
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_cwmmRequestBmpDeletion");
+
+
+  /*
+    Unfortunately only bitmaps for real files are currently deleted. When using links in folders
+    the lock counter isn't touched so we don't get a notification.
+    _wpUnlockObject isn't called when links are going dormant (do they?) after closing the links folder.
+
+    BTW XWorkplace (V1.0.0) keeps every object locked
+    after first touching it and NEVER completely unlocks it!
+   */
+    TRY_LOUD(BITMAP_DELETION) {
+      if((pui=_wpFindUseItem(somSelf, USAGE_RECORD, NULLHANDLE))==NULLHANDLE) {
+        bDeleteBmp=TRUE;
+      }
+      else {
+        /* There's at least one usage record. Check if the icon is visible */
+        RECTL rectl2;
+        PRECORDITEM pri=(PRECORDITEM)(++pui);
+        
+        /*
+          V0.2.9 CW 2004/11/12
+          
+          Check if small bitmaps for icons are currently visible in any container. This is useful if the
+          user scrolls a folder with a lot of pictures.
+          */
+        pui--;
+        bDeleteBmp=TRUE;
+        for(;pui ; pui=_wpFindUseItem(somSelf, USAGE_RECORD, pui)) {
+          pri=(PRECORDITEM)(++pui);
+          pui--;
+          if(WinSendMsg(pri->hwndCnr, CM_QUERYVIEWPORTRECT, MPFROMP(&rectl2), MPFROM2SHORT(CMA_WORKSPACE, FALSE))) {
+            
+            if(pri->pRecord->ptlIcon.y >= rectl2.yBottom  && pri->pRecord->ptlIcon.y <= rectl2.yTop &&
+               pri->pRecord->ptlIcon.x >= rectl2.xLeft && pri->pRecord->ptlIcon.x < rectl2.xRight)
+              bDeleteBmp=FALSE;
+            
+          }/* WinSendMsg() */   
+        }
+      }/* else */
+    }/* Try */
+    CATCH(BITMAP_DELETION)
+      {
+        SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d.\n",
+                          __FUNCTION__, __FILE__, __LINE__);
+      } END_CATCH;
+
+    if(bDeleteBmp) {
+      /* Check if queue is full. If yes post semaphore so the other thread cleans up. */
+      if(ulNumBMPDelete> BMP_DEL_UPPER) {
+        DosPostEventSem(hevDeleteBMP);
+        /* Yield cpu so the delete thread may run */
+        DosSleep(20);
+        /* Thread isn't fast enough so delete the bitmap directly */
+        if(ulNumBMPDelete>BMP_QUEUE_SIZE-7) {
+          _cwmmFreeBitmaps(somSelf);
+          return;
+        }
+      }
+      ulNumBMPDelete++;
+      WinPostMsg(g_hwndDeleteBMP, IMGWM_DELETEBITMAP, MPFROMP(somSelf), MPFROM2SHORT(0, ACKEY_CREATE_SMALLBITMAP));
+    }
+}
+
+/*
+ * The prototype for cwimg_wpQueryBitmapHandle was replaced by the following prototype:
+ */
+SOM_Scope BOOL  SOMLINK cwimg_wpQueryBitmapHandle(MMImage *somSelf, 
+                                                  HBITMAP* phBitmap, 
+                                                  HPAL* phPalette, 
+                                                  ULONG ulWidth, 
+                                                  ULONG ulHeight, 
+                                                  ULONG ulFlags, 
+                                                  long lBackgroundColor, 
+                                                  BOOL* pbQuitEarly)
+{
+  ULONG ulSize;
+  char chrName[CCHMAXPATH];
+
+    MMImageData *somThis = MMImageGetData(somSelf); 
+    MMImageMethodDebug("MMImage","cwimg_wpQueryBitmapHandle");
+
+    /* Check parameter */
+    if(!phBitmap)
+      return FALSE;
+
+    if(!_wpReadImageFile(somSelf))
+      return FALSE;
+
+    *phBitmap=NULLHANDLE;
+    if(phPalette)
+      *phPalette=NULLHANDLE;
+
+    ulSize=sizeof(chrName);
+    if(!_wpQueryRealName(somSelf, chrName, &ulSize,TRUE))
+      return FALSE;
+
+    
+    TRY_LOUD(QRY_HBM) {
+      /* Create a new (maybe smaller) bitmap from the normal size bitmap */
+      *phBitmap=createNewBitmap ( _hBitmap, (PBITMAPINFOHEADER2) _pBmpInfoHeader2, 
+                                  ulWidth, ulHeight , pbQuitEarly);
+    }
+    CATCH(QRY_HBM)
+      {
+        *phBitmap=NULLHANDLE;
+
+        SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d while calling createNewBitmap().\n",
+                          __FUNCTION__, __FILE__, __LINE__);
+        SysWriteToTrapLog("Image file: %s\n\n",
+                          chrName);
+      } END_CATCH;
+      
+      if(!*phBitmap)
+        return FALSE;
+
+    return TRUE;
+}
+
+/*
+ * The prototype for cwimg_wpQueryBitmapInfoHeader was replaced by the following prototype:
+ */
+SOM_Scope PBYTE  SOMLINK cwimg_wpQueryBitmapInfoHeader(MMImage *somSelf)
+{
+  ULONG ulSize;
+  char chrName[CCHMAXPATH];
+  PBYTE pByte=NULLHANDLE;
+  BOOL bGotHeader=FALSE;
+  BOOL bSem;
+
+  MMImageData *somThis = MMImageGetData(somSelf); 
+    MMImageMethodDebug("MMImage","cwimg_wpQueryBitmapInfoHeader");
+
+#ifdef DEBUG
+      SysWriteToTrapLog("In _wpQueryBitmapInfoHeader(), line %d\n", __LINE__);
+#endif
+
+    /* This is necessary for newly created files. */
+    if(!_wpIsObjectInitialized(somSelf))
+      return NULLHANDLE;
+
+
+#ifdef DEBUG
+    ulSize=sizeof(chrName);
+    if(_wpQueryRealName(somSelf, chrName, &ulSize,TRUE))
+      SysWriteToTrapLog("In _wpQueryBitmapInfoHeader() for %s\n", chrName);
+    else
+      SysWriteToTrapLog("In _wpQueryBitmapInfoHeader(), filename unknown\n");
+#endif
+
+    if(_pBmpInfoHeader2)
+      return _pBmpInfoHeader2;
+
+    if(_bNoIOProcAvailable)
+      return NULL; /* No IO-proc for this image format. Don't try again in the future. */
+
+    /*
+      Don't request the object sem here. The call may block at least when a light table
+      folder tries to show the object.
+      Problem is that there's a race condition with the code in the light table frame proc trying
+      to get the bitmap header (now disabled if small bitmap can't be loaded) for newly inserted
+      objects. As soon as _wpAllocMem() is called in the code below the WPS blocks. Probably there's
+      a problem with inserting the USAGE_MEMORY item in the in use list while the folder is inserting
+      a USAGE_RECORD item. One would assume requesting the mutex solves this but no go... The call
+      to _wpRequestObjectMutexSem() just blocks for the specified timeout without returning the semaphor.
+      Probably that's exactly what's happening in _wpAllocMem().
+
+      bSem=_wpRequestObjectMutexSem(somSelf, 3000);//SEM_INDEFINITE_WAIT);
+
+      */
+
+#if 0
+    if(!_wpAssertObjectMutexSem(somSelf))
+      {
+        DosBeep(500, 130);
+#if 0
+        //        bSem=_wpRequestObjectMutexSem(somSelf, 3000);
+        if(bSem)
+          {
+            DosBeep(5000, 130);
+            _wpReleaseObjectMutexSem(somSelf);
+            //return NULLHANDLE;
+          }
+#endif
+      }
+#endif
+
+    TRY_LOUD(GET_BMPIH) {
+      for(;;)
+        {
+
+          ulSize=sizeof(chrName);
+          if(!_wpQueryRealName(somSelf, chrName, &ulSize,TRUE))
+            break;
+
+          //          if((pByte=_wp_AllocMem(somSelf, sizeof(BITMAPINFOHEADER2)+256*sizeof(RGB2), &ulSize))==NULLHANDLE)
+          if((pByte=malloc(sizeof(BITMAPINFOHEADER2)+256*sizeof(RGB2)))==NULLHANDLE)
+            break;
+
+          bGotHeader=getBmpInfoHeader( (PBITMAPINFOHEADER2) pByte, chrName, _chrIOProcName, 
+                                       sizeof(_chrIOProcName), &_bNoIOProcAvailable);
+          break;
+        }
+    }
+    CATCH(GET_BMPIH)
+      {
+#if 0
+        if(MBID_YES==showMsgBoxFlag(IDSTR_CWIMAGETITLE, IDSTR_IMGIOPROCCRASH, queryModuleHandle(),
+                             MB_YESNO | MB_MOVEABLE | MB_WARNING))
+          exit(0);
+#endif
+        SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d while calling getBmpInfoHeader().\n",
+                          __FUNCTION__, __FILE__, __LINE__);
+        SysWriteToTrapLog("Image file: %s\n\n",
+                          chrName);
+      } END_CATCH;
+
+#if 0
+      if(bSem) {
+        //DosBeep(5000, 50);
+      _wpReleaseObjectMutexSem(somSelf);
+      }
+#endif
+
+#ifdef DEBUG
+      if(bGotHeader)
+        SysWriteToTrapLog("%s Got header...\n", __FUNCTION__);
+      else
+        SysWriteToTrapLog("Error with header...\n");
+#endif
+
+    if(!bGotHeader) {
+      if(pByte)
+        free(pByte);
+        //        _wp_FreeMem(somSelf, pByte);
+      _pBmpInfoHeader2=NULLHANDLE;
+      _chrIOProcName[0]=0;
+      return NULL;
+    }
+    _pBmpInfoHeader2=pByte;
+    /* Update instance data */
+    if(((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cbFix==sizeof(BITMAPINFOHEADER2)) {
+      _ulWidth=((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cx;
+      _ulHeight=((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cy;
+      _ulDepth=((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cBitCount;
+    }
+    else {
+      PBITMAPINFOHEADER pBmpInfoHdr=(PBITMAPINFOHEADER)_pBmpInfoHeader2;
+      _ulWidth=pBmpInfoHdr->cx;
+      _ulHeight=pBmpInfoHdr->cy;
+      _ulDepth=pBmpInfoHdr->cBitCount;
+    }
+
+    return (PBYTE) _pBmpInfoHeader2;
+}
+
+/*
+ * The prototype for cwimg_wpQueryBitmapData was replaced by the following prototype:
+ */
+SOM_Scope PBYTE  SOMLINK cwimg_wpQueryBitmapData(MMImage *somSelf, 
+                                                 ULONG* pulSize)
+{
+    /* CWImageData *somThis = CWImageGetData(somSelf); */
+    MMImageMethodDebug("MMImage","cwimg_wpQueryBitmapData");
+
+    NOT_IMPLEMENTED
+
+    return (MMImage_parent_WPImageFile_wpQueryBitmapData(somSelf, 
+                                                         pulSize));
+}
+
+/*
+ * The prototype for cwimg_wpSetBitmapData was replaced by the following prototype:
+ */
+SOM_Scope BOOL  SOMLINK cwimg_wpSetBitmapData(MMImage *somSelf, 
+                                              PBYTE pBitmapData, 
+                                              ULONG ulSize)
+{
+    /* CWImageData *somThis = CWImageGetData(somSelf); */
+    MMImageMethodDebug("MMImage","cwimg_wpSetBitmapData");
+
+    NOT_IMPLEMENTED
+
+#if 0
+    WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
+                  "This function is not available. Please tell the author the steps causing this message box so the function may be implemented.",
+                  "cwimg_wpSetBitmapData",
+                  0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
+#endif
+
+    return (MMImage_parent_WPImageFile_wpSetBitmapData(somSelf, 
+                                                       pBitmapData, 
+                                                       ulSize));
+}
+
+/*
+ * The prototype for cwimg_wpReadImageFile was replaced by the following prototype:
+ */
+SOM_Scope BOOL  SOMLINK cwimg_wpReadImageFile(MMImage *somSelf)
+{
+  char chrName[CCHMAXPATH];
+  ULONG ulSize;
+  BOOL bGotHeader=FALSE;
+
+  MMImageData *somThis = MMImageGetData(somSelf); 
+    MMImageMethodDebug("MMImage","cwimg_wpReadImageFile");
+
+    if(!_wpIsObjectInitialized(somSelf))
+      return NULLHANDLE;
+
+    if(_hBitmap)
+      return TRUE;
+
+    ulSize=sizeof(chrName);
+    if(!_wpQueryRealName(somSelf, chrName, &ulSize,TRUE))
+      return FALSE;
+
+#ifdef DEBUG
+    SysWriteToTrapLog("In _wpReadImageFile(), file: %s \n",
+             chrName);
+#endif
+
+    TRY_LOUD(LOAD_BMP) {
+      if(_wpQueryBitmapInfoHeader(somSelf))
+        bGotHeader=TRUE;
+    }
+    CATCH(LOAD_BMP)
+      {
+        SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d while calling _wpQueryBitmapInfoHeader().\n",
+                          __FUNCTION__, __FILE__, __LINE__);
+        SysWriteToTrapLog("Image file: %s\n",
+                          chrName);
+      }END_CATCH;
+      
+      if(!bGotHeader)
+        return FALSE;
+      _hBitmap=NULLHANDLE;
+
+      TRY_LOUD(LOAD_BMP2) {
+        _hBitmap=loadBitmap ( chrName , (PBITMAPINFOHEADER2) _pBmpInfoHeader2);
+      }
+      CATCH(LOAD_BMP2)
+        {
+          SysWriteToTrapLog("\nTrap occured in %s (LOAD_BMP2), file %s, around line %d while calling _wpQueryBitmapInfoHeader()\nwith image file %s.\n",
+                            __FUNCTION__, __FILE__, __LINE__, chrName);
+          SysWriteToTrapLog("Remembering file as invalid.\n");
+          /*
+            V0.2.8 CW 2004/11/01
+
+            Mark file which caused a trap as invalid.
+           */
+          _bNoIOProcAvailable=TRUE;
+        } END_CATCH;
+        
+        if(!_hBitmap) {
+          return FALSE;
+        }
+        
+        return TRUE;
+}
+
+
+SOM_Scope BOOL  SOMLINK cwimg_wpWriteImageFile(MMImage *somSelf)
+{
+    /* CWImageData *somThis = CWImageGetData(somSelf); */
+    MMImageMethodDebug("MMImage","cwimg_wpWriteImageFile");
+
+    NOT_IMPLEMENTED
+
+#if 0
+    WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
+                  "This function is not available. Please tell the author the steps causing this message box so the function may be implemented.",
+                  "cwimg_wpWriteImageFile",
+                  0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
+#endif
+
+    return (MMImage_parent_WPImageFile_wpWriteImageFile(somSelf));
+}
+
+/*
+ * wpInitData:   override; Not used. Default is instance var initializing to zero and that's what we need.
+ */
+
+
+SOM_Scope void  SOMLINK cwimg_wpUnInitData(MMImage *somSelf)
+{
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_wpUnInitData");
+
+    if(_pBmpInfoHeader2) {
+      free(_pBmpInfoHeader2);
+      //  _wp_FreeMem(somSelf, _pBmpInfoHeader2);
+      _pBmpInfoHeader2=NULLHANDLE;
+    }
+    /* This frees all bitmaps. Small for icons and the normal size one */
+    _cwmmFreeBitmaps(somSelf);
+    MMImage_parent_WPImageFile_wpUnInitData(somSelf);
+}
+
+/*
+  FIXME:
+
+  This function isn't thread safe because of one global memory area. It is supposed to be
+  called from the wpPopupMenu() method. This method can only be called once at
+  a time, so that's not a problem. It may become a problem if this function is also
+  called from somewhere else. The global mem pointer is used by the image class and the
+  audio class.
+*/
+BOOL insertIOProcMenuItems( HWND hwndMenu )
+{
+    CHAR          szBuffer[ sizeof( FOURCC ) + CCHMAXPATH + 4 ];
+    MMFORMATINFO  mmFormatInfo;
+    PMMFORMATINFO pmmFormatInfoArray;
+    ULONG         ulReturnCode;
+    LONG          lFormatsRead;
+    LONG          index;
+    LONG          lBytesRead;
+    HWND hwndSubMenu;
+    MENUITEM mi;
+    
+    if(g_pmmFormatInfoArray)
+      free(g_pmmFormatInfoArray);
+    g_pmmFormatInfoArray=NULLHANDLE;
+
+    memset( &mmFormatInfo,
+            '\0',
+            sizeof(MMFORMATINFO) );
+    
+    mmFormatInfo.ulMediaType |= MMIO_MEDIATYPE_IMAGE;
+    mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED;    
+    ulReturnCode = mmioQueryFormatCount ( &mmFormatInfo,
+                                          &lNumIOProcs,
+                                          0,
+                                          0 );
+    
+    if( ulReturnCode != MMIO_SUCCESS )
+      {
+        /* Error - mmioQueryFormatCount failed. */
+        return FALSE;
+      }
+
+    /*
+     * Allocate enough memory for n number of FormatInfo blocks
+     */
+    g_pmmFormatInfoArray = malloc (lNumIOProcs * sizeof( MMFORMATINFO ) );
+    if( g_pmmFormatInfoArray == NULL )
+      {
+        /* Could not allocate enough memory for mmFormatInfo array. */
+        return FALSE;
+      }
+    
+    /*
+     * call mmioGetFormats to get info on the formats supported.
+     */
+    ulReturnCode = mmioGetFormats( &mmFormatInfo,
+                                   lNumIOProcs,
+                                   g_pmmFormatInfoArray,
+                                   &lFormatsRead,
+                                   0,
+                                   0 );
+    if( ulReturnCode != MMIO_SUCCESS )
+      {
+        /*
+         *  mmioGetFormats failed.
+         */
+        free(g_pmmFormatInfoArray);
+        g_pmmFormatInfoArray=NULLHANDLE;
+        return FALSE;
+      }
+    
+    if( lFormatsRead != lNumIOProcs )
+      {
+        /*
+         * Error in MMIO - number of formats read in by
+         * mmioGetFormats is not equal to number of formats
+         * found by mmioQueryFormatCount.
+         */
+        free(g_pmmFormatInfoArray);
+        g_pmmFormatInfoArray=NULLHANDLE;
+        return FALSE;
+      }
+
+    // Create Empty Submenu //
+    hwndSubMenu=WinCreateWindow(hwndMenu,WC_MENU,"",0,
+                                0,0,0,0,
+                                hwndMenu,//Owner. If set, this window 
+                                //is destroyed if owner is destroyed
+                                HWND_TOP,
+                                ID_MENU_CONVERT,//menuid
+                                NULL,NULL);
+
+    mi.iPosition=MIT_END;
+    mi.afStyle=MIS_TEXT;//|MIS_SUBMENU;
+    mi.id=ID_MENU_CONVERT;
+    mi.afAttribute=NULLHANDLE;    
+    mi.hwndSubMenu=NULLHANDLE;//hwndSubMenu;
+    mi.hItem=NULLHANDLE;
+    mi.hwndSubMenu=hwndSubMenu;
+
+    if(!getMessage(szBuffer, IDSTR_MENU_CONVERT, sizeof(szBuffer), queryResModuleHandle(), HWND_DESKTOP))
+       sprintf(szBuffer,"~Convert to");
+    WinSendMsg(hwndMenu,MM_INSERTITEM,(MPARAM)&mi,
+               (MPARAM)szBuffer);
+
+    pmmFormatInfoArray=g_pmmFormatInfoArray;
+    for ( index = 0; index <lNumIOProcs; index++ )
+      {
+        mmioGetFormatName(pmmFormatInfoArray, szBuffer, &lBytesRead, 0L, 0L);
+        
+        /* Insert NULL string terminator */
+        *( szBuffer + lBytesRead ) = (CHAR)NULL;
+
+        /* Compressed TIF is not supported because the Warp 4 IO-Procs are
+           broken. */
+        //        HlpWriteToTrapLog("---------  IO-Proc: %s, Name: %s\n",  pmmFormatInfoArray->szDefaultFormatExt,
+        //                szBuffer);
+
+        if(pmmFormatInfoArray->fccIOProc!=mmioStringToFOURCC("TFMC",MMIO_TOUPPER) &&
+           pmmFormatInfoArray->fccIOProc!=mmioStringToFOURCC("TFIC",MMIO_TOUPPER) &&
+           (pmmFormatInfoArray->ulFlags & MMIO_CANWRITETRANSLATED))
+          {
+            /* Add menu item */
+            /* Fill the MENUITEM structure */
+            mi.iPosition=MIT_END;
+            mi.afStyle=MIS_TEXT|MIS_SUBMENU;
+            mi.id=ID_ITEM_FIRSTCONVERT+index;/* Create menu id */
+            mi.afAttribute=NULLHANDLE;    
+            mi.hwndSubMenu=NULLHANDLE;//hwndSubMenu;
+            mi.hItem=NULLHANDLE;
+            WinSendMsg(hwndSubMenu, MM_INSERTITEM,(MPARAM)&mi,
+                       (MPARAM)szBuffer);
+          }
+        /*
+         *  advance to next entry in mmFormatInfo array
+         */        
+        pmmFormatInfoArray++;
+      }
+    return TRUE;
+}
+
+
+
+/*
+ * wpInitData:   override; Not used. Default is instance var initializing to zero and that's what we need.
+ */
+
+SOM_Scope ULONG  SOMLINK cwimg_wpQueryDefaultView(MMImage *somSelf)
+{
+  ULONG ulReturn;
+
+  /*    MMImageData *somThis = MMImageGetData(somSelf);*/
+    MMImageMethodDebug("MMImage","cwimg_wpQueryDefaultView");
+
+    ulReturn=(MMImage_parent_WPImageFile_wpQueryDefaultView(somSelf));
+
+    if(ulReturn==OPEN_RUNNING)
+      {
+        ULONG ulHowMatched=1;
+        char chrID[100];
+        /* Check if associated program is still available */
+        if(!_wpQueryAssociatedProgram(somSelf, OPEN_RUNNING, &ulHowMatched,
+                                      chrID, sizeof(chrID),(PSZ)-1))
+          return ID_MENU_IMGEDITOR; /* The associated progarm is lost */
+      }
+    return ulReturn;
+}
+
+/*
+ * The prototype for cwimg_wpModifyPopupMenu was replaced by the following prototype:
+ */
+SOM_Scope BOOL  SOMLINK cwimg_wpModifyPopupMenu(MMImage *somSelf, 
+                                                HWND hwndMenu, 
+                                                HWND hwndCnr, 
+                                                ULONG iPosition)
+{
+  MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_wpModifyPopupMenu");
+    _wpInsertPopupMenuItems(somSelf, hwndMenu, 1, queryResModuleHandle(), ID_MENU_IMGEDITOR, 1);
+
+    TRY_LOUD(IMAGE_INSERTPOPUPMENU) {
+      /* Insert image info */
+      if(_ulWidth!=0 && _ulHeight!=0 && _ulDepth!=0)
+        {
+          char text[120];
+          char menuText[200];
+          MENUITEM menuItem;
+
+          if(!getMessage(text, IDSTR_MENU_IMAGEINFO, sizeof(text), queryResModuleHandle(), hwndMenu))
+            strcpy(text, "Image information: %d x %d x %d");
+          
+          sprintf(menuText, text, _ulWidth, _ulHeight, _ulDepth);//create menuitem
+          
+          //insert size menuitem in popupmenu
+
+          menuItem.iPosition=MIT_END;
+          menuItem.afStyle=MIS_TEXT|MIS_STATIC;
+          menuItem.afAttribute=0;
+          menuItem.id=ID_MENU_IMAGEINFO;
+          menuItem.hwndSubMenu=NULLHANDLE;
+          menuItem.hItem=0;
+          WinSendMsg(hwndMenu,MM_INSERTITEM,(MPARAM)&menuItem,(MPARAM)&menuText);
+        }
+      /* Insert all known image I/O procs */
+      insertIOProcMenuItems( hwndMenu );
+      menuInsertMenuSeparator(hwndMenu, NULLHANDLE, MIT_END );
+      
+    }/* TRY_LOUD */
+    CATCH(IMAGE_INSERTPOPUPMENU)
+      {
+        SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d.\n",
+                          __FUNCTION__, __FILE__, __LINE__);
+      } END_CATCH;
+
+    return (MMImage_parent_WPImageFile_wpModifyPopupMenu(somSelf, 
+                                                         hwndMenu, 
+                                                         hwndCnr, 
+                                                         iPosition));
+}
+
+
+/*
+ * The prototype for cwimg_wpMenuItemSelected was replaced by the following prototype:
+ */
+SOM_Scope BOOL  SOMLINK cwimg_wpMenuItemSelected(MMImage *somSelf, 
+                                                 HWND hwndFrame, 
+                                                 ULONG ulMenuId)
+{
+  /*    MMImageData *somThis = MMImageGetData(somSelf);*/
+    MMImageMethodDebug("MMImage","cwimg_wpMenuItemSelected");
+
+    if(ulMenuId>=ID_ITEM_FIRSTCONVERT && ulMenuId<=ID_ITEM_FIRSTCONVERT+lNumIOProcs-1)
+      {
+        char chrEditor[CCHMAXPATH]={0};
+        char chrParams[2*CCHMAXPATH]="\"";
+        char *chrPtr=chrParams;
+        ULONG ulSize;
+        ULONG ulRc;
+        
+        PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "imageconverter", "", chrEditor,
+                              sizeof(chrEditor));
+        chrPtr++;
+        ulSize=sizeof(chrParams);
+        _wpQueryRealName(somSelf, chrPtr, &ulSize, TRUE);
+        strcat(chrPtr,"\" \"");
+        chrPtr=strrchr(chrPtr, 0);
+        mmioGetFormatName(&g_pmmFormatInfoArray[ulMenuId-ID_ITEM_FIRSTCONVERT], chrPtr,(LONG*) &ulSize, 0L, 0L);
+        *( chrPtr + ulSize ) = (CHAR)NULL;
+        strcat(chrPtr,"\"");
+
+        if((ulRc=launchPMProg("", chrEditor, chrParams, somSelf, ulMenuId-ID_ITEM_FIRSTCONVERT))==NULLHANDLE) {
+          /* Error */
+          return TRUE;
+        }
+        return TRUE;
+      }
+
+    switch(ulMenuId)
+      {
+      case ID_MENU_IMGEDITOR:
+        _wpViewObject(somSelf, NULLHANDLE, ulMenuId, 0);
+        return TRUE;
+      default:
+        break;
+      }
+
+    return (MMImage_parent_WPImageFile_wpMenuItemSelected(somSelf, 
+                                                          hwndFrame, 
+                                                          ulMenuId));
+}
+
+/*
+ * The prototype for cwimg_wpOpen was replaced by the following prototype:
+ */
+SOM_Scope HWND  SOMLINK cwimg_wpOpen(MMImage *somSelf, HWND hwndCnr, 
+                                     ULONG ulView, ULONG param)
+{
+  /*    CWImageData *somThis = CWImageGetData(somSelf); */
+    MMImageMethodDebug("MMImage","cwimg_wpOpen");
+
+   switch(ulView)
+     {
+     case ID_MENU_IMGEDITOR:
+        /*case 0xbc2b:   editor */
+        {
+          char chrEditor[CCHMAXPATH]={0};
+          char chrParams[CCHMAXPATH+2]="\"";
+          char chrTitle[50];
+          char *chrPtr=chrParams;
+          ULONG ulSize;
+          ULONG ulRc;
+
+          //          PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "imageeditor", "ib.exe", chrEditor,
+          //                    sizeof(chrEditor)); /* Default is ib.exe */
+          if(!PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "imageeditor", NULLHANDLE, chrEditor,
+                                    sizeof(chrEditor)))
+            /* No user setting. Use default ib.exe copied by the installation program to another location. IF this setting is missing
+               try the app from the path. */
+            PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "ib", "ib.exe", chrEditor,
+                                  sizeof(chrEditor));
+
+
+          chrPtr++;
+          ulSize=sizeof(chrParams)-2;
+          _wpQueryRealName(somSelf, chrPtr, &ulSize, TRUE);
+          strcat(chrPtr,"\"");
+          if(!getMessage(chrTitle, IDSTR_IMGEDITORTITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
+            strcpy(chrTitle, "Editor");
+
+          if((ulRc=launchPMProg( chrTitle, chrEditor, chrParams, somSelf, ulView))==NULLHANDLE) {
+            return NULLHANDLE;
+          }
+          return NULLHANDLE;
+        }
+     default:
+       break;
+     }
+
+    return (MMImage_parent_WPImageFile_wpOpen(somSelf, hwndCnr, 
+                                              ulView, param));
+}
+
+
+/*
+ * The prototype for cwimg_wpAddSettingsPages was replaced by the following prototype:
+ */
+SOM_Scope BOOL  SOMLINK cwimg_wpAddSettingsPages(MMImage *somSelf, 
+                                                 HWND hwndNotebook)
+{
+  BOOL rc;
+  /*    MMImageData *somThis = MMImageGetData(somSelf);*/
+    MMImageMethodDebug("MMImage","cwimg_wpAddSettingsPages");
+
+    rc=(MMImage_parent_WPImageFile_wpAddSettingsPages(somSelf, 
+                                                          hwndNotebook));
+    return rc | (_cwmmAddImageInformationPage(somSelf, hwndNotebook));
+}
+
+
+/*
+ * The prototype for cwimg_wpQueryDetailsData was replaced by the following prototype:
+ */
+SOM_Scope ULONG  SOMLINK cwimg_wpQueryDetailsData(MMImage *somSelf, 
+                                                  PVOID* ppDetailsData, 
+                                                  PULONG pcp)
+{
+    BOOL rcParent;
+    PIMAGEDETAILS pImageDetails;
+
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_wpQueryDetailsData");
+
+    /* Fill parent info */
+    rcParent=(MMImage_parent_WPImageFile_wpQueryDetailsData(somSelf, 
+                                                          ppDetailsData, 
+                                                          pcp));
+
+    /* The WPS asks for data to be displayed */
+    if(ppDetailsData)
+      {
+        ULONG ulWidth, ulHeight, ulDepth;
+      
+        PBITMAPINFOHEADER2 pBmpInfoHeader2=NULLHANDLE;       
+
+#if 0
+        if(_bUseNewClsFeatures) /* Read info from CD only if allowed. The check if the object
+                                   is on CD is done in wpRestore() */
+          pBmpInfoHeader2=(PBITMAPINFOHEADER2) _wpQueryBitmapInfoHeader(somSelf);
+#endif   
+
+        pBmpInfoHeader2=(PBITMAPINFOHEADER2)_pBmpInfoHeader2;
+
+        if(pBmpInfoHeader2) {
+          //DosBeep(1500,200);
+          if(pBmpInfoHeader2->cbFix==sizeof(BITMAPINFOHEADER2)) {
+            ulWidth=pBmpInfoHeader2->cx;
+            ulHeight=pBmpInfoHeader2->cy;
+            ulDepth=pBmpInfoHeader2->cBitCount;
+          }
+          else {
+            PBITMAPINFOHEADER pBmpInfoHeader=(PBITMAPINFOHEADER)pBmpInfoHeader2;
+            ulWidth=pBmpInfoHeader->cx;
+            ulHeight=pBmpInfoHeader->cy;
+            ulDepth=pBmpInfoHeader->cBitCount;
+          }
+        }
+        else
+          {
+            ulWidth=_ulWidth;
+            ulHeight=_ulHeight;
+            ulDepth=_ulDepth;
+          }
+        /* Fill the structure with the info to be displayed */      
+        pImageDetails=(PIMAGEDETAILS)*ppDetailsData;  
+        pImageDetails->ulWidth=ulWidth;
+        pImageDetails->ulHeight=ulHeight;
+        pImageDetails->ulDepth=ulDepth;
+        pImageDetails->pszFormat=_chrIOProcName;
+        
+        *ppDetailsData=((PBYTE) (*ppDetailsData))+sizeof(*pImageDetails);          
+      }
+    else
+      {
+        /* Buffer size is queried */
+        if(pcp)
+          *pcp+=sizeof(*pImageDetails);
+      }
+    return rcParent;
+}
+
+/*
+ * The prototype for cwimg_wpRestoreState was replaced by the following prototype:
+ */
+SOM_Scope BOOL  SOMLINK cwimg_wpRestoreState(MMImage *somSelf, 
+                                             ULONG ulReserved)
+{
+    BOOL bReRead=FALSE;
+
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_wpRestoreState");
+    
+    _bUseNewClsFeatures=TRUE;
+    
+    if(cwObjectIsOnCD(somSelf)) {
+      /* The object is on CD. Check if we should use the new class features */
+      if(!PrfQueryProfileInt(HINI_USERPROFILE, "CWMM", IMAGECLS_FEATURES_ON_CD_KEY, 0))
+        _bUseNewClsFeatures=FALSE;
+    }
+
+    /* Use cached image size so the values are shown in details view on first opening of a folder. The problem is that
+       wpQueryDetailsData() is called before the object data is fully initialized. wpIsObjectInitialized() returns
+       TRUE but wpQueryRealName() fails at that early stage so it's impossible to read the image data from the file (because
+       the filename is unknown). Querying the image data in wpObjectReady() is to late because that method is called after
+       wpQueryDetailsData(). In wpObjectReady the image header will be read in. */
+    
+    /* Query the image info */
+    if(!_wpRestoreLong(somSelf, "CWImage", KEY_FILESIZE, &_ulFileSize))
+      bReRead=TRUE;
+    if(!_wpRestoreLong(somSelf, "CWImage", KEY_WIDTH, &_ulWidth))
+      bReRead=TRUE;
+    if(!_wpRestoreLong(somSelf, "CWImage", KEY_HEIGHT, &_ulHeight))
+      bReRead=TRUE;
+    if(!_wpRestoreLong(somSelf, "CWImage", KEY_DEPTH, &_ulDepth))
+      bReRead=TRUE;
+    if(_ulWidth==0 || _ulHeight==0 || _ulDepth!=0)
+      bReRead=TRUE;
+    //    if(_bUseNewClsFeatures) /* Read info from CD only if allowed. The check if the object
+    //                         is on CD is done in wpRestore() */
+    //      _wpQueryBitmapInfoHeader(somSelf);
+
+    return (MMImage_parent_WPImageFile_wpRestoreState(somSelf, 
+                                                      ulReserved));
+}
+
+void mmRefreshRecords(MMImage *somSelf)
+{
+  PUSEITEM pUse;
+
+    for(pUse=_wpFindUseItem(somSelf, USAGE_RECORD/*VIEW_CONTENTS|VIEW_DETAILS|VIEW_TREE*/, NULL );pUse;
+        pUse=_wpFindUseItem(somSelf, USAGE_RECORD/* VIEW_CONTENTS|VIEW_DETAILS|VIEW_TREE*/, pUse ))
+      {
+        PRECORDITEM pRecordItem=(PRECORDITEM)++pUse;
+        WinPostMsg(pRecordItem->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pRecordItem->pRecord),
+                   MPFROM2SHORT(1,CMA_NOREPOSITION));
+      }/* for() */
+}
+
+SOM_Scope BOOL  SOMLINK cwimg_wpSetup(MMImage *somSelf, PSZ pszSetupString)
+{
+  char buffer[CCHMAXPATH];
+  ULONG bufferSize;
+
+  /*    MMImageData *somThis = MMImageGetData(somSelf);*/
+    MMImageMethodDebug("MMImage","cwimg_wpSetup");
+
+
+    /* Refresh */
+    bufferSize=sizeof(buffer); 
+    if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMREFRESH, buffer,&bufferSize))
+      {
+        _cwmmFreeBitmaps(somSelf);
+#if 0
+        _cwmmQuerySmallBitmapHandle(somSelf, 
+                                    0, 
+                                    NULLHANDLE, 
+                                    0);
+#endif
+        mmRefreshRecords(somSelf);
+        //        _wpCnrRefreshDetails(somSelf);
+      }
+    
+    return (MMImage_parent_WPImageFile_wpSetup(somSelf, pszSetupString));
+}
+
+
+SOM_Scope void  SOMLINK cwimg_wpObjectReady(MMImage *somSelf, 
+                                            ULONG ulCode, WPObject* refObject)
+{  
+  PCREATEBMPINFO pCreateBMP;
+  ULONG ulError;
+  MMImageData *somThis = MMImageGetData(somSelf);
+  MMImageMethodDebug("MMImage","cwimg_wpObjectReady");
+  
+  MMImage_parent_WPImageFile_wpObjectReady(somSelf, ulCode, 
+                                           refObject);
+  /* Get image info asynchronous to replace cached image size read in from EA  which
+     may not be accurate. */
+  /* Allocate memory for small bitmap info for the thread */
+#if 0
+  if(hwndCreateBMP && (pCreateBMP=(PCREATEBMPINFO)_wpAllocMem(somSelf, sizeof(CREATEBMPINFO),&ulError))!=NULLHANDLE)
+    {
+      /* Only the object pointer is used */
+      pCreateBMP->wpObject=somSelf;
+      
+      //      WinPostMsg(hwndCreateBMP, WM_APPTERMINATENOTIFY,MPFROMP(pCreateBMP), MPFROM2SHORT(0, ACKEY_QUERY_BITMAPINFO));      
+    }
+#endif
+    /* Refresh records in all views */
+    //mmRefreshRecords(somSelf);
+
+}
+
+static BOOL _getMissingExtFromImageIOProc(void)
+{
+    MMFORMATINFO  mmFormatInfo;
+    PMMFORMATINFO pmmFormatInfoArray;
+    void * memPtr;
+    ULONG         ulReturnCode;
+    LONG          lFormatsRead;
+    LONG          index;
+
+    memset( &mmFormatInfo,
+            '\0',
+            sizeof(MMFORMATINFO) );
+    
+    mmFormatInfo.ulMediaType |= MMIO_MEDIATYPE_IMAGE;
+    mmFormatInfo.ulFlags|=MMIO_CANREADTRANSLATED;/* Read !!!*/    
+    ulReturnCode = mmioQueryFormatCount ( &mmFormatInfo,
+                                          &lNumIOProcs,
+                                          0,
+                                          0 );
+    
+    if( ulReturnCode != MMIO_SUCCESS )
+      {
+        /*
+         * Error - mmioQueryFormatCount failed.
+         */
+        return FALSE;
+      }
+
+    /*
+     * Allocate enough memory for n number of FormatInfo blocks
+     */
+    pmmFormatInfoArray = malloc (lNumIOProcs * sizeof( MMFORMATINFO ) );
+    memPtr=pmmFormatInfoArray;
+    if( pmmFormatInfoArray == NULL )
+      {
+        /*
+         * Could not allocate enough memory for mmFormatInfo array.
+         */
+        return FALSE;
+      }
+    
+    /*
+     * call mmioGetFormats to get info on the formats supported.
+     */
+    ulReturnCode = mmioGetFormats( &mmFormatInfo,
+                                   lNumIOProcs,
+                                   pmmFormatInfoArray,
+                                   &lFormatsRead,
+                                   0,
+                                   0 );
+    if( ulReturnCode != MMIO_SUCCESS )
+      {
+        /*
+         *  mmioGetFormats failed.
+         */
+        free(pmmFormatInfoArray);
+        return FALSE;
+      }
+    
+    if( lFormatsRead != lNumIOProcs )
+      {
+        /*
+         * Error in MMIO - number of formats read in by
+         * mmioGetFormats is not equal to number of formats
+         * found by mmioQueryFormatCount.
+         */
+        free(pmmFormatInfoArray);
+        return FALSE;
+      }
+
+
+    for ( index = 0; index <lNumIOProcs; index++ )
+      {
+        /* Now scan the whole image proc array */
+
+        if(!strstr(chrMMImageKnownExt, pmmFormatInfoArray->szDefaultFormatExt)) {
+          /* This extension is yet unknown */
+          if(chrMMImageExt[0]==0) {
+            /* It's the first one */
+            sprintf(chrMMImageExt,"*.%s", pmmFormatInfoArray->szDefaultFormatExt);
+          }
+          else {
+            /* Check if the extension is not already added (e.g. TIF has a lot of subformats) */
+            if(!strstr(chrMMImageExt, pmmFormatInfoArray->szDefaultFormatExt)) {
+              strncat(chrMMImageExt,",*.",sizeof(chrMMImageExt)-1-strlen(chrMMImageExt));
+              strncat(chrMMImageExt, pmmFormatInfoArray->szDefaultFormatExt, sizeof(chrMMImageExt)-1-strlen(chrMMImageExt));
+            }
+          }
+          //          HlpWriteToTrapLog("Known Extension: %s\n", chrMMImageKnownExt);
+          //          HlpWriteToTrapLog("Extension: %s\n", chrMMImageExt);
+        }  
+        /*
+         *  advance to next entry in mmFormatInfo array
+         */        
+        pmmFormatInfoArray++;
+      }
+    free(memPtr);
+
+    return FALSE;
+}
+
+/*
+ *    wpCnrRemoveObject          : override;
+ */
+
+/*
+ *    wpFormatDragItem           : override;
+ */
+
+SOM_Scope BOOL  SOMLINK cwimg_wpSaveState(MMImage *somSelf)
+{
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_wpSaveState");
+
+    /* Cache the image size so the values are shown in details view on first opening of a folder. The problem is that
+     wpQueryDetailsData() is called before the object data is fully initialized. wpIsObjectInitialized() returns
+     TRUE but wpQueryRealName() fails at that early stage so it's impossible to read the image data from the file (because
+     the filename is unknown). Querying the image data in wpObjectReady() is to late because this method is called after
+     wpQueryDetailsData(). */
+    if(_pBmpInfoHeader2) {
+      if(((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cbFix==sizeof(BITMAPINFOHEADER2)) {
+        _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cx);    
+        _wpSaveLong(somSelf, "CWImage", KEY_HEIGHT, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cy);
+        _wpSaveLong(somSelf, "CWImage", KEY_DEPTH, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cBitCount);
+      }
+      else {
+        PBITMAPINFOHEADER pBmpInfoHeader=(PBITMAPINFOHEADER)_pBmpInfoHeader2;
+
+        _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, pBmpInfoHeader->cx);    
+        _wpSaveLong(somSelf, "CWImage", KEY_HEIGHT, pBmpInfoHeader->cy);
+        _wpSaveLong(somSelf, "CWImage", KEY_DEPTH, pBmpInfoHeader->cBitCount);
+      }
+    }
+    return (MMImage_parent_WPImageFile_wpSaveState(somSelf));
+}
+
+#if 0
+SOM_Scope BOOL  SOMLINK cwimg_wpFormatDragItem(MMImage *somSelf, 
+                                               PDRAGITEM pdrgItem)
+{
+  BOOL rc;
+
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_wpFormatDragItem");
+
+    rc= (MMImage_parent_WPImageFile_wpFormatDragItem(somSelf, 
+                                                        pdrgItem));
+DosBeep(500,10);
+SysWriteToTrapLog("%d\n",pdrgItem->cxOffset);
+    pdrgItem->cxOffset+=60;
+    return rc;
+}
+#endif
+
+SOM_Scope BOOL  SOMLINK cwimg_wpUnlockObject(MMImage *somSelf)
+{
+    MMImageData *somThis = MMImageGetData(somSelf);
+    MMImageMethodDebug("MMImage","cwimg_wpUnlockObject");
+
+    /*
+      Call a function which checks if the bitmaps of this object may be deleted in the background.
+      The call is here because this method is called for every object in a folder whenever a folder
+      is closed.
+      If the folder is closed it's likely the bitmaps may be obsolete. A check for USAGE_RECORD items
+      will be done on another thread.
+ 
+      wpDeleteFromObjUseList() seems to be the more natural place to do this but the method is not called
+      when an object is removed from a container. Also wpCnrRemoveObject() doesn't work because the WPS seems
+      to use wpclsRemoveObjects() to remove all objects when closing folders.
+
+      XWP (at least up to 1.02) keeps every object locked, so we can't just check the lock state by
+      querying wpIsObjectLocked(). That's the reason we jump through loops here :-(.
+
+     */
+    if(_hBitmap || _hBitmapSmall) 
+      sendDeleteBMPMsg(somSelf);
+
+    return (MMImage_parent_WPImageFile_wpUnlockObject(somSelf));
+}
+
+
+
+
+
+
+
+
+/*
+ * The prototype for cwimgM_wpclsInitData was replaced by the following prototype:
+ */
+SOM_Scope void  SOMLINK cwimgM_wpclsInitData(M_MMImage *somSelf)
+{
+  PCLASSFIELDINFO pCfi;
+  USHORT i;
+  static BOOL bGotImgExt=FALSE;
+
+    /* M_CWImageData *somThis = M_CWImageGetData(somSelf); */
+    M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsInitData");
+
+    /* Get extensions of additional image procs not represented by a class.
+       Strangely enough wpclsQueryInstanceFilter() is called during wpclsInitData() so
+       we query the extensions here before calling the parent so we have the information. */
+    if(!bGotImgExt)
+      {
+        /* Get user supplied extensions e.g. *.JPE*/
+        getStringFromRexxScript("imageadd.rx", chrMMImageExt, sizeof(chrMMImageExt));
+
+        /* Get all already handled extensions */
+        getStringFromRexxScript("imageext.rx", chrMMImageKnownExt, sizeof(chrMMImageKnownExt));
+        /* Now check installed IO procs for other exts and add them to the filter list */
+        _getMissingExtFromImageIOProc();
+        bGotImgExt=TRUE; 
+      }
+
+    M_MMImage_parent_M_WPImageFile_wpclsInitData(somSelf);
+
+    if(!globalHab)
+      globalHab=WinQueryAnchorBlock(HWND_DESKTOP);
+
+    if(!getMessage(chrHelpLibrary, IDSTR_HELPLIBRARY, sizeof(chrHelpLibrary), 
+                   queryModuleHandle(), HWND_DESKTOP))
+      strcpy(chrHelpLibrary,"MMPARTS.HLP");
+
+    /* Load strings for details titles */
+    if(getMessage(chrWidth, IDSTR_IMAGEDETAIL_WIDTH, sizeof(chrWidth), queryResModuleHandle(), HWND_DESKTOP))
+      pszImageColTitles[0]=chrWidth;
+    if(getMessage(chrHeight, IDSTR_IMAGEDETAIL_HEIGHT, sizeof(chrHeight), queryResModuleHandle(), HWND_DESKTOP))
+      pszImageColTitles[1]=chrHeight;
+    if(getMessage(chrDepth, IDSTR_IMAGEDETAIL_DEPTH, sizeof(chrDepth), queryResModuleHandle(), HWND_DESKTOP))
+      pszImageColTitles[2]=chrDepth;
+    if(getMessage(chrFormat, IDSTR_IMAGEDETAIL_FORMAT, sizeof(chrFormat), queryResModuleHandle(), HWND_DESKTOP))
+      pszImageColTitles[3]=chrFormat;
+
+    /* Setup the static data for the details view */
+    for(i=0,pCfi=cfiImageFieldInfo;i<NUM_IMAGE_DETAILS_FIELDS;i++,pCfi++)
+      {
+        memset((PCH)pCfi,0,sizeof(CLASSFIELDINFO));
+        
+        pCfi->cb=sizeof(CLASSFIELDINFO);
+        pCfi->flData=CFA_LEFT|CFA_SEPARATOR|CFA_FIREADONLY;
+        pCfi->flTitle=CFA_CENTER|CFA_SEPARATOR|CFA_HORZSEPARATOR|CFA_STRING|CFA_FITITLEREADONLY;
+        pCfi->pNextFieldInfo=pCfi+1;
+        pCfi->pTitleData=(PVOID)pszImageColTitles[i];
+        pCfi->flCompare=COMPARE_SUPPORTED|SORTBY_SUPPORTED;
+        
+        switch(i)
+          {
+          case 0: /* Width */
+            pCfi->flData|=CFA_ULONG;
+            pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(IMAGEDETAILS, ulWidth));
+            pCfi->ulLenFieldData=sizeof(ULONG);
+            pCfi->ulLenCompareValue=sizeof(ULONG);
+            pCfi->DefaultComparison=CMP_GREATER;
+            break;
+          case 1: /* Height */
+            pCfi->flData|=CFA_ULONG;
+            pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(IMAGEDETAILS,ulHeight));
+            pCfi->ulLenFieldData=sizeof(ULONG);
+            pCfi->ulLenCompareValue=sizeof(ULONG);
+            pCfi->DefaultComparison=CMP_GREATER;
+            break;
+          case 2: /* Depth */
+            pCfi->flData|=CFA_ULONG;
+            pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(IMAGEDETAILS,ulDepth));
+            pCfi->ulLenFieldData=sizeof(ULONG);
+            pCfi->ulLenCompareValue=sizeof(ULONG);
+            pCfi->DefaultComparison=CMP_GREATER;
+            break;
+          case 3: /* Format */
+            pCfi->flData|=CFA_STRING;
+            pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(IMAGEDETAILS,pszFormat));
+            pCfi->ulLenFieldData=sizeof(PSZ);
+            pCfi->DefaultComparison=CMP_EQUAL;
+            break;
+          }/* switch(i) */
+      }/* for() */
+    cfiImageFieldInfo[NUM_IMAGE_DETAILS_FIELDS].pNextFieldInfo=NULL;    
+    if(!hwndCreateBMP)
+      _beginthread(createBMPThreadFunc,NULL,8192*20, NULLHANDLE); //Fehlerbehandlung fehlt
+
+    if(!g_hwndDeleteBMP)
+      _beginthread(deleteBMPThreadFunc,NULL,8192*10, NULLHANDLE); //Fehlerbehandlung fehlt
+
+}
+
+
+/*
+ * The prototype for cwimgM_wpclsQueryDefaultView was replaced by the following prototype:
+ */
+SOM_Scope ULONG  SOMLINK cwimgM_wpclsQueryDefaultView(M_MMImage *somSelf)
+{
+#if 0
+  char chrID[120];
+  WPObject *wpObject;
+  HOBJECT hObject;
+#endif
+    /* M_CWImageData *somThis = M_CWImageGetData(somSelf); */
+    M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsQueryDefaultView");
+
+    //    sprintf(chrID, "<MMPM2_MM%sTEMPLATE>", _wpclsQueryInstanceType(somSelf));
+    //HlpWriteToTrapLog("%s\n", chrID);
+#if 0
+    if((hObject=WinQueryObject(chrID))!=NULLHANDLE)
+      DosBeep(5000, 500);
+      //      _wpclsQueryObject(somSelf, hObject);
+    if((wpObject=_wpclsQueryObjectFromPath(somSelf, chrID))!=NULLHANDLE)
+      {
+        ULONG ulHowMatched=1;
+        
+        DosBeep(5000, 1000);
+        /* Template found. Now query associated program */
+        if(_wpQueryAssociatedProgram(wpObject, VIEW_RUNNING, &ulHowMatched,
+                                  chrID, sizeof(chrID),(PSZ)-1))
+          DosBeep(500, 1000);
+      }
+#endif        
+    /* Create default templates. We do it here because we need an object to query the associated
+       program (if any) when the system asks for the default view. */
+return OPEN_RUNNING;
+//    return ID_MENU_IMGEDITOR;
+}
+
+
+BOOL checkImageIOProc(char * chrExt)
+{
+    CHAR          szBuffer[ sizeof( FOURCC ) + CCHMAXPATH + 4 ];
+    MMFORMATINFO  mmFormatInfo;
+    PMMFORMATINFO pmmFormatInfoArray;
+    void * memPtr;
+    ULONG         ulReturnCode;
+    LONG          lFormatsRead;
+    LONG          index;
+    LONG          lBytesRead;
+
+    memset( &mmFormatInfo,
+            '\0',
+            sizeof(MMFORMATINFO) );
+    
+    mmFormatInfo.ulMediaType |= MMIO_MEDIATYPE_IMAGE;
+    mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED;    
+    ulReturnCode = mmioQueryFormatCount ( &mmFormatInfo,
+                                          &lNumIOProcs,
+                                          0,
+                                          0 );
+    
+    if( ulReturnCode != MMIO_SUCCESS )
+      {
+        /*
+         * Error - mmioQueryFormatCount failed.
+         */
+        return FALSE;
+      }
+
+    /*
+     * Allocate enough memory for n number of FormatInfo blocks
+     */
+    pmmFormatInfoArray = malloc (lNumIOProcs * sizeof( MMFORMATINFO ) );
+    memPtr=pmmFormatInfoArray;
+    if( pmmFormatInfoArray == NULL )
+      {
+        /*
+         * Could not allocate enough memory for mmFormatInfo array.
+         */
+        return FALSE;
+      }
+    
+    /*
+     * call mmioGetFormats to get info on the formats supported.
+     */
+    ulReturnCode = mmioGetFormats( &mmFormatInfo,
+                                   lNumIOProcs,
+                                   pmmFormatInfoArray,
+                                   &lFormatsRead,
+                                   0,
+                                   0 );
+    if( ulReturnCode != MMIO_SUCCESS )
+      {
+        /*
+         *  mmioGetFormats failed.
+         */
+        free(pmmFormatInfoArray);
+        return FALSE;
+      }
+    
+    if( lFormatsRead != lNumIOProcs )
+      {
+        /*
+         * Error in MMIO - number of formats read in by
+         * mmioGetFormats is not equal to number of formats
+         * found by mmioQueryFormatCount.
+         */
+        free(pmmFormatInfoArray);
+        return FALSE;
+      }
+
+
+    for ( index = 0; index <lNumIOProcs; index++ )
+      {
+        mmioGetFormatName(pmmFormatInfoArray, szBuffer, &lBytesRead, 0L, 0L);
+        
+        /* Insert NULL string terminator */
+        *( szBuffer + lBytesRead ) = (CHAR)NULL;
+
+        /* Compressed TIF is not supported because the Warp 4 IO-Procs are
+           broken. */
+        //HlpWriteToTrapLog("---------  Ext: %s, IO-Proc: %s, Name: %s\n", 
+        //chrExt,  pmmFormatInfoArray->szDefaultFormatExt,
+        //                szBuffer);
+
+        if(pmmFormatInfoArray->fccIOProc!=mmioStringToFOURCC("TFMC",MMIO_TOUPPER) &&
+           pmmFormatInfoArray->fccIOProc!=mmioStringToFOURCC("TFIC",MMIO_TOUPPER) &&
+           (pmmFormatInfoArray->ulFlags & MMIO_CANWRITETRANSLATED))
+          {
+            if(strstr(chrExt, pmmFormatInfoArray->szDefaultFormatExt)) {
+              //HlpWriteToTrapLog("******* Ext given: %s  IO-Proc: %s\n", chrExt, pmmFormatInfoArray->szDefaultFormatExt);
+              free(memPtr);
+              return TRUE;
+            }
+          }
+        /*
+         *  advance to next entry in mmFormatInfo array
+         */        
+        pmmFormatInfoArray++;
+      }
+    free(memPtr);
+
+    return FALSE;
+}
+
+SOM_Scope BOOL  SOMLINK cwimgM_wpclsCreateDefaultTemplates(M_MMImage *somSelf, 
+                                                           WPObject* Folder)
+{
+    /* M_MMImageData *somThis = M_MMImageGetData(somSelf); */
+    M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsCreateDefaultTemplates");
+
+    //HlpWriteToTrapLog("Class title: %s\n", _wpclsQueryTitle(somSelf));
+
+    /* The FOURCC of the JPEG-IO proc is JPEG so we have to create that template
+       in the JPG class. */
+    
+    if(checkImageIOProc( _wpclsQueryInstanceFilter(somSelf))) {
+      //   WPFolder* wpFolder;
+      //  wpFolder=_wpclsQueryFolder(somSelf, "<MMPM2_MMTEMPLATEFOLDER>", FALSE);
+      // return M_MMAudio_parent_M_MMDataFile_wpclsCreateDefaultTemplates(somSelf, wpFolder);
+      //            HlpWriteToTrapLog("Create template for: %s\n", _wpclsQueryTitle(somSelf));
+      //     HlpWriteToTrapLog("Create template for: %s\n", _somGetClassName(somSelf) );
+      mmclsCreateTheDefaultTemplate(somSelf, Folder);
+      return TRUE;
+    }
+
+    return TRUE;
+}
+
+SOM_Scope ULONG  SOMLINK cwimgM_wpclsQueryStyle(M_MMImage *somSelf)
+{
+    /* M_MMImageData *somThis = M_MMImageGetData(somSelf); */
+    M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsQueryStyle");
+
+    return CLSSTYLE_NEVERPRINT;
+    //    return (M_MMImage_parent_M_WPImageFile_wpclsQueryStyle(somSelf));
+}
+
+/*
+ * The prototype for cwimgM_wpclsQueryTitle was replaced by the following prototype:
+ */
+SOM_Scope PSZ  SOMLINK cwimgM_wpclsQueryTitle(M_MMImage *somSelf)
+{
+  static char chrTitle[20]={0};
+    /* M_CWImageData *somThis = M_CWImageGetData(somSelf); */
+    M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsQueryTitle");
+
+    if(chrTitle[0]==0)
+      if(!getMessage(chrTitle, IDSTR_CWIMAGETITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
+        strcpy(chrTitle,"Digital Image");
+
+    return chrTitle;
+}
+
+/*
+ * The prototype for cwimgM_wpclsQueryIconData was replaced by the following prototype:
+ */
+/*
+ *    wpclsQueryDefaultHelp: override;
+ */
+
+SOM_Scope ULONG  SOMLINK cwimgM_wpclsQueryIconData(M_MMImage *somSelf, 
+                                                   PICONINFO pIconInfo)
+{
+  HMODULE hmod;
+
+    /* M_CWImageData *somThis = M_CWImageGetData(somSelf); */
+    M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsQueryIconData");
+
+    hmod=queryModuleHandle();
+    if(!hmod)
+      return M_MMImage_parent_M_WPImageFile_wpclsQueryIconData(somSelf, pIconInfo);
+
+	if (pIconInfo)   {
+      pIconInfo->fFormat = ICON_RESOURCE;
+      pIconInfo->hmod    = hmod;
+      pIconInfo->resid   = ID_ICONCWIMAGEFILE;
+	} /* endif */
+
+	return ( sizeof(ICONINFO) );
+}
+
+/*
+ * The prototype for cwimgM_wpclsQueryDetailsInfo was replaced by the following prototype:
+ */
+SOM_Scope ULONG  SOMLINK cwimgM_wpclsQueryDetailsInfo(M_MMImage *somSelf, 
+                                                      PCLASSFIELDINFO* ppClassFieldInfo, 
+                                                      PULONG pSize)
+{
+  ULONG cParentColumns;
+  PCLASSFIELDINFO pCfi;
+  int i;
+
+    /* M_CWImageData *somThis = M_CWImageGetData(somSelf); */
+    M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsQueryDetailsInfo");
+
+    cParentColumns= (M_MMImage_parent_M_WPImageFile_wpclsQueryDetailsInfo(somSelf, 
+                                                                 ppClassFieldInfo, 
+                                                                 pSize));
+  if(pSize)
+    *pSize+=sizeof(IMAGEDETAILS);
+
+  if(ppClassFieldInfo)
+    {
+      if(*ppClassFieldInfo)
+        {
+          pCfi=*ppClassFieldInfo;
+          for(i=0; i<cParentColumns;i++)
+            pCfi=(pCfi->pNextFieldInfo ? pCfi->pNextFieldInfo: pCfi);
+
+          pCfi->pNextFieldInfo=cfiImageFieldInfo;
+        }
+      else
+        *ppClassFieldInfo=cfiImageFieldInfo;
+    }
+    return (cParentColumns+NUM_IMAGE_DETAILS_FIELDS);
+}
+
+
+
+SOM_Scope PSZ  SOMLINK cwimgM_wpclsQueryInstanceFilter(M_MMImage *somSelf)
+{
+    /* M_MMImageData *somThis = M_MMImageGetData(somSelf); */
+    M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsQueryInstanceFilter");
+
+    //return "*.png,*.sdf,*.klj,*jpe,*.zui";
+    return chrMMImageExt;
+    /*    return (M_MMImage_parent_M_WPImageFile_wpclsQueryInstanceFilter(somSelf));*/
+}
+
Index: /trunk/mediafolder/include/progfolder.hh
===================================================================
--- /trunk/mediafolder/include/progfolder.hh	(revision 59)
+++ /trunk/mediafolder/include/progfolder.hh	(revision 59)
@@ -0,0 +1,141 @@
+/*
+ *
+ * Include file with class definitions for class CWProgFolder
+ *
+ *             (C) Chris Wohlgenuth 1999-2002
+ *
+ * This class is intended for programmers and provides functions for some
+ * common tasks like:
+ *                     - Adding dialogs as frame controls to WPS folders
+ *                     - Showing 'About'-dialogs
+ *                     - Checking of object pointers
+ *                     - ...
+ *
+ * Use IBM VAC++ V3.00 and Gnu-make 3.74.1 to compile
+ *
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#define INCL_DOS
+#define INCL_WIN
+#include <os2.h>
+
+/* Structure which holds information about our
+   frame controls */
+typedef struct {
+    HWND hwndCtlLeft;
+    BOOL bLeft;
+    ULONG ulFlagsLeft;
+    SIZEL sizelLeftFrame;
+
+    HWND hwndCtlRight;
+    BOOL bRight;
+    ULONG ulFlagsRight;
+    SIZEL sizelRightFrame;
+
+    HWND hwndCtlTop;
+    BOOL bTop;
+    ULONG ulFlagsTop;
+    SIZEL sizelTopFrame;
+
+    HWND hwndCtlBottom;
+    BOOL bBottom;
+    ULONG ulFlagsBottom;
+    SIZEL sizelBottomFrame;
+
+  BOOL bCnrAdjusted;
+}FRAMECTRLDATA;
+
+/* Some stuff necessary for the compiler */
+#pragma SOMAsDefault(on)
+#include "som.hh"
+#include "somcls.hh"
+#pragma SOMNoMangling(on)
+/* Include file with definition for WPFolder class */
+#include "WPFOLDER.hh"
+/* Include file with definition for WPShadow class */
+#include "wpshadow.hh"
+
+
+
+/* Class definition for the Metaclass of our new folder class */
+class M_CWProgFolder:public M_WPFolder
+{
+#pragma SOMClassName(*,"M_CWProgFolder")
+  /* Minimal SOM-Version we need. No change necessary */
+#pragma SOMClassVersion(*,1,3)
+#pragma SOMCallstyle(oidl)
+public:
+  /* The member functions we want to override */
+  virtual PSZ  wpclsQueryTitle();
+  virtual ULONG wpclsQueryStyle();
+  virtual void wpclsInitData();
+
+  /* This statement describes new memberfunctions if we introduce them */
+#pragma SOMReleaseOrder()
+};
+
+/* The new folder class. It's a child of WPFolder-class */
+class CWProgFolder:public WPFolder
+{
+  /* The class name */
+#pragma SOMClassName(*,"CWProgFolder")
+  /* The name of the class' Metaclass */
+#pragma SOMMetaClass(CWProgFolder,"M_CWProgFolder")
+  /* SOM must be Version 1.2 or above */
+#pragma SOMClassVersion(CWProgFolder,1,3)
+#pragma SOMCallstyle(oidl)
+private:
+  /* We have no private data or functions */
+public:
+  /* Overridden or new functions come here */
+  /* This one is overridden */
+    virtual HWND wpOpen(HWND hwndCnr,ULONG ulView,ULONG ulParam);
+    virtual BOOL cwClose(HWND hwndFrame);
+  /* This one is a new one */
+    virtual ULONG cwNumAdditionalFrameControls(HWND hwndFolder);
+    virtual BOOL cwCalculateClient(HWND hwndFolder, PRECTL pRectl, BOOL which);
+    virtual ULONG cwFormatFrame(HWND hwndFolder, USHORT countSWP,PSWP pswp);
+    virtual BOOL cwAddFrameCtl(HWND hwndFolder,HWND hwndNewCtl,SIZEL sizel, ULONG ulPos, ULONG ulFlags);
+    virtual HWND cwQueryFrameCtl(HWND hwndFolder, SIZEL* sizel, ULONG ulPos, ULONG * ulFlags);
+    virtual void cwUpdateFrame(HWND hwndFolder);
+    virtual WPObject* cwGetFileSystemObject(WPObject* wpObject);
+    virtual ULONG cwShowAboutDlg(HMODULE hModule, ULONG idDialog);
+    virtual BOOL cwQueryCDDrives(int *iNumCD, char * cFirstDrive);
+  virtual ULONG cwInsertUserMenuItems(HWND hwndMenu, char* chrMenuFolder, ULONG ulFirstId, BOOL bLeadingSeparator);
+  virtual BOOL cwCheckUserMenuItems( char* chrMenuFolder, USHORT usItemId);
+
+    //  virtual ULONG cwQueryAudioCDInfo(char * drive);
+  /* Tell SOM the order of the new functions. NEVER change the order in
+     future versions or you break binary compatibility! */
+#pragma SOMReleaseOrder( \
+"cwNumAdditionalFrameControls",\
+"cwCalculateClient",\
+"cwFormatFrame",\
+"cwAddFrameCtl",\
+"cwQueryFrameCtl",\
+"cwUpdateFrame",\
+"cwGetFileSystemObject",\
+"cwShowAboutDlg",\
+"cwQueryCDDrives",\
+"cwClose",\
+"cwInsertUserMenuItems",\
+"cwCheckUserMenuItems")
+};
+
+
+
Index: /trunk/mediafolder/include/wpobject.hh
===================================================================
--- /trunk/mediafolder/include/wpobject.hh	(revision 59)
+++ /trunk/mediafolder/include/wpobject.hh	(revision 59)
@@ -0,0 +1,1948 @@
+#ifndef _DTS_HH_INCLUDED_wpobject
+#define _DTS_HH_INCLUDED_wpobject
+/* Start Class WPObject */
+
+// This file was generated by the IBM "DirectToSOM" emitter for C++ (V1.77)
+// Generated at 10/22/96 06:18:53 EDT
+// This is class: WPObject
+// Mangled class name: WPObject
+// SE: May 19/94
+
+#pragma SOMAsDefault(off)
+
+/********************************************/
+
+      /* Object style flags (see wpSetStyle) */
+
+      #define OBJSTYLE_NOMOVE          2
+      #define OBJSTYLE_NOLINK          4
+      #define OBJSTYLE_NOCOPY          8
+      #define OBJSTYLE_NOTDEFAULTICON 16   /* Intentionally not declared CLSSTYLE */ 
+      #define OBJSTYLE_TEMPLATE       32
+      #define OBJSTYLE_NODELETE       64
+      #define OBJSTYLE_NOPRINT       128
+      #define OBJSTYLE_NODRAG        256
+      #define OBJSTYLE_NOTVISIBLE    512
+      #define OBJSTYLE_NOSETTINGS   1024
+      #define OBJSTYLE_NORENAME     2048
+      #define OBJSTYLE_NODROP       4096
+      #define OBJSTYLE_NODROPON     8192   /* Use instead of OBJSTYLE_NODROP, 
+                                              because OBJSTYLE_NODROP and     
+                                              CLSSTYLE_PRIVATE have the same  
+                                              value (DD 86093F) */            
+      #define OBJSTYLE_CUSTOMICON   16384  /* Use instead of OBJSTYLE_NOTDEFAULTICON  
+                                               because OBJSTYLE_NOTDEFAULTICON and    
+                                               CLSSTYLE_NEVERTEMPLATE have the same   
+                                               value (DD 86093F) */      
+
+     /*  Class style flags (see wpclsQueryStyle) */
+
+      #define CLSSTYLE_NEVERMOVE      OBJSTYLE_NOMOVE
+      #define CLSSTYLE_NEVERLINK      OBJSTYLE_NOLINK
+      #define CLSSTYLE_NEVERCOPY      OBJSTYLE_NOCOPY
+      #define CLSSTYLE_NEVERTEMPLATE  16
+      #define CLSSTYLE_NEVERDELETE    OBJSTYLE_NODELETE
+      #define CLSSTYLE_NEVERPRINT     OBJSTYLE_NOPRINT
+      #define CLSSTYLE_NEVERDRAG      OBJSTYLE_NODRAG
+      #define CLSSTYLE_NEVERVISIBLE   OBJSTYLE_NOTVISIBLE
+      #define CLSSTYLE_NEVERRENAME    OBJSTYLE_NORENAME
+      #define CLSSTYLE_PRIVATE        4096   /* Intentionally not declared OBJSTYLE */     
+      #define CLSSTYLE_NEVERSETTINGS  OBJSTYLE_NOSETTINGS                      /*DD 86093F*/ 
+      #define CLSSTYLE_NEVERDROPON    OBJSTYLE_NODROPON                        /*DD 86093F*/ 
+      #define CLSSTYLE_HIDDEN         32768  /* Use instead of CLSSTYLE_PRIVATE          
+                                                 because OBJSTYLE_NODROP and             
+                                                 CLSSTYLE_PRIVATE have the same          
+                                                 value (DD 86093F) */                    
+      #define CLSSTYLE_DONTTEMPLATE   65536  /* Use instead of CLSSTYLE_NEVERTEMPLATE    
+                                                 because OBJSTYLE_NOTDEFAULTICON and     
+                                                 CLSSTYLE_NEVERTEMPLATE have the same    
+                                                 value (DD 86093F) */       
+
+      #define SETTINGS_PAGE_REMOVED  -1
+
+
+      /* Notes: The class name immediately follows the control block. The
+       *        first instance variable control block immediately follows
+       *        this.
+       */
+      typedef struct _WPSRCLASSBLOCK
+      {
+        SHORT   ClassNameLength;       /* Length of class name, including the
+                                        * .. null terminator. This must be a
+                                        * .. SHORT and must be at the beginning
+                                        * .. of the structure.
+                                        */
+        USHORT  IVarLength;            /* Length of instance variable
+                                        * .. information, including the two-
+                                        * .. byte null terminator
+                                        */
+      } WPSRCLASSBLOCK;
+
+ //GKY missing? fixme
+ typedef struct _FILTERFLAGS
+      {
+         ULONG       cbItem;
+         ULONG       Flags[3];
+      } FILTERFLAGS;
+      typedef FILTERFLAGS *PFILTERFLAGS;
+
+
+      /* This control structure does not reside in the dormant state.
+       * It is used only when a persistant data block is
+       * resident in memory - either when an object is being saved or
+       * when it is being restored...
+       */
+      typedef struct _OBJDATA
+      {
+         WPSRCLASSBLOCK       *CurrentClass;
+         WPSRCLASSBLOCK       *First;
+         PUCHAR                NextData;
+         USHORT                Length;
+      } OBJDATA;
+      typedef OBJDATA *POBJDATA;
+
+     /*  wpCnrInsertObject/wpCnrRemoveObject structs
+       *  and macros...
+       */
+
+      typedef struct _CLASSDETAILS     /* Class Details struct */
+      {
+         PSZ          pszAttribute;    /* Translatable string for a class attribute*/
+         PVOID        pSortRecord;     /* Function pointer for sort function for attribute*/
+         struct _CLASSDETAILS *pNext; /* Next item in class details list */
+      } CLASSDETAILS;
+      typedef CLASSDETAILS *PCLASSDETAILS;
+
+
+     /* Details comparison function definition
+       *
+       *    Param1  PVOID   - Pointer to details field value
+       *    Param2  PVOID   - Pointer to value to be compared with
+       *
+       *    Returns LONG    - Must be CMP_EQUAL, CMP_GREATER, CMP_LESS
+       */
+      typedef LONG (EXPENTRY FNCOMPARE)(PVOID,PVOID);
+      typedef FNCOMPARE *PFNCOMPARE;
+
+
+     /* This structure is always followed immediately by a type
+       * dependant struct such as MEMORYITEM,RECORDITEM,VIEWITEM
+       * or some other user defined structure...
+       */
+      typedef struct _USEITEM
+      {
+         ULONG  type;                  /* Type of this Item */
+         struct _USEITEM *pNext;   /* Next item in use list */
+      } USEITEM;
+      typedef USEITEM *PUSEITEM;
+
+      #define USAGE_MEMORY          1  /* Values of 'type' */
+      #define USAGE_RECORD          4
+      #define USAGE_OPENVIEW        5
+      #define USAGE_LINK            6
+      #define USAGE_OPENFILE       20
+
+      typedef struct _MEMORYITEM       /* USAGE_MEMORY struct */
+      {
+         ULONG     cbBuffer;           /* Number of bytes in memory block */
+      } MEMORYITEM;
+      typedef MEMORYITEM *PMEMORYITEM;
+
+    typedef struct _RECORDITEM       /* USAGE_RECORD struct */
+      {
+         HWND            hwndCnr;      /* Cnr into which object is inserted */
+         PMINIRECORDCORE pRecord;      /* Record pointer within that cnr */
+         ULONG           ulUser;       /* For application use RECSH */ 
+      } RECORDITEM;
+      typedef RECORDITEM *PRECORDITEM;
+
+      typedef struct _VIEWITEM         /* USAGE_OPENVIEW struct */
+      {
+         ULONG        view;            /* Object view that this represents */
+         LHANDLE      handle;          /* Open handle */
+         ULONG        ulViewState;     /* View State flags */
+         HWND         hwndCnr;         /* System use only (window animation) */
+         PMINIRECORDCORE pRecord;      /* System use only (window animation) */
+      } VIEWITEM;
+      typedef VIEWITEM *PVIEWITEM;
+
+      typedef struct _LINKITEM         /* USAGE_LINK struct */
+      {
+         WPObject    *LinkObj;         /* The link object */
+      } LINKITEM;
+      typedef LINKITEM *PLINKITEM;
+
+      typedef struct _VIEWFILE         /* USAGE_OPENFILE struct */
+      {
+         ULONG        ulMenuId;        /* Menu id if association or menu page */
+         LHANDLE      handle;          /* Open handle */
+         HWND         hwndCnr;         /* System use only (window animation) */
+         PMINIRECORDCORE pRecord;      /* System use only (window animation) */
+      } VIEWFILE;
+      typedef VIEWFILE *PVIEWFILE;
+
+
+     #define VIEWSTATE_OPENING       0x0001   /* The view is being opened */
+      #define VIEWSTATE_OBJECTDELETED 0x0002   /* The object has been deleted */
+      #define VIEWSTATE_USERHIDDEN    0x0004   /* The view was hidden by user */
+      #define VIEWSTATE_POPULATING    0x0008   /* The view is populating      */
+      #define VIEWSTATE_USERMINIMIZED 0x0010   /* The view was minimized by the user */
+      #define VIEWSTATE_CLOSING       0x0020   /* The view is closing */
+      #define VIEWSTATE_DELETING      0x0040   /* The object is being deleted */
+
+
+     typedef struct _TASKREC
+      {
+         struct _TASKREC *next;     /* next in the list of current tasks   */
+         ULONG            useCount; /* can be referenced by multiple object*/
+         PVOID            pStdDlg;  /* ptr to standard WP task dialog      */
+         WPFolder        *folder;   /* intended folder for the object      */
+         LONG             xOrigin;  /* intended position for the object    */
+         LONG             yOrigin;  /* intended position for the object    */
+         PSZ              pszTitle; /* intended name for the object        */
+         ULONG            cbTitle;  /* length of the name buffer           */
+         PMINIRECORDCORE  positionAfterRecord; /* intended sort position   */
+         BOOL            fKeepAssociations;
+         PVOID            pReserved;    /* reserved - equal null           */
+
+      }  TASKREC;
+      typedef TASKREC *PTASKREC;
+
+
+
+      /* Owner draw function definition
+       *
+       *    Param1  HWND  - Handle of window that is being painted
+       *    Param2  PVOID - POWNERITEM structure pointer, see the container
+       *                    control programming reference for the meaning
+       *                    of the fields in this structure.
+       *    Param3  PVOID - Pointer to the comparison value to draw (this
+       *                    is NULL, except when this function is painting
+       *                    its value into the include criteria dialog
+       *                    when it points to Criteria.CompareValue...)
+       *
+       *    Returns BOOL  - TRUE if the field was ownerdrawn, FALSE if the
+       *                    container control should do default painting.
+       */
+      typedef BOOL (EXPENTRY FNOWNDRW)(HWND,PVOID,PVOID);
+      typedef FNOWNDRW *PFNOWNDRW;
+
+      /* Structure for wpclsQueryDetailsInfo method
+       *
+       * CLASSFIELDINFO is identical to the FIELDINFO structure of the
+       * container control with the following differences:
+       *
+       * - The offStruct field from FIELDINFO is reserved.
+       * - The offFieldData and usLenFieldData structure elements have
+       *   been added.
+       * - Compare/Sort/Ownerdraw fields have also been added for the
+       *   convenience of the programmer, so that object details can
+       *   be customized and objects can be found or included by any
+       *   of their displayable object details.
+       *
+       * For example if the application has the following details data:
+       *
+       * typedef struct _SAMPLE {
+       *   CDATE   cdate;
+       *   CTIME   ctime;
+       *   PSZ     psz;
+       * }  SAMPLE;
+       *
+       * classfieldinfo[0].offFieldData   = FIELDOFFSET(SAMPLE,cdate);
+       * classfieldinfo[0].ulLenFieldData = FIELDOFFSET(SAMPLE,ctime) -
+       *                                    FIELDOFFSET(SAMPLE,cdate);
+       *
+       * classfieldinfo[1].offFieldData   = FIELDOFFSET(SAMPLE,ctime);
+       * classfieldinfo[1].ulLenFieldData = FIELDOFFSET(SAMPLE,psz) -
+       *                                    FIELDOFFSET(SAMPLE,ctime);
+       *
+       * classfieldinfo[2].offFieldData   = FIELDOFFSET(SAMPLE,psz);
+       * classfieldinfo[2].ulLenFieldData = sizeof(SAMPLE) -
+       *                                    FIELDOFFSET(SAMPLE,psz);
+       *
+       * NOTE: It is essential that the fields be linked in order ex. above
+       *       cdate must be followed by ctime and finally psz.
+       */
+      typedef struct _CLASSFIELDINFO                                    /*!INC*/
+      {
+         /* Details field attributes
+          */
+         ULONG      cb;                  /* size of CLASSFIELDINFO struct  */
+         ULONG      flData;              /* attributes of field's data     */
+         ULONG      flTitle;             /* attributes of field's title    */
+         PVOID      pTitleData;          /* title data (default is string) */
+                                         /* If CFT_BITMAP, must be HBITMAP */
+         ULONG      ulReserved;          /* Reserved                       */
+         PVOID      pUserData;           /* pointer to user data           */
+         struct _CLASSFIELDINFO *pNextFieldInfo; /* pointer to next linked */
+                                                /* CLASSFIELDINFO structure*/
+         ULONG      cxWidth;             /* width of field in pels         */
+         ULONG      offFieldData;        /* offset from beginning of       */
+                                         /*   this class's data for this   */
+                                         /*   field. (first field is 0).   */
+         ULONG      ulLenFieldData;      /* width of data in bytes.        */
+                                         /*   (4 for a pointer).           */
+         PFNOWNDRW  pfnOwnerDraw;        /* Ownerdraw procedure for detail */
+                                         /* column. Can be NULL except if  */
+                                         /* ownerdraw is being used.       */
+         /* Include/Sort parameters
+          */
+         ULONG      flCompare;           /* Flags: for example, use the    */
+                                         /*   COMPARE_SUPPORTED flag if    */
+                                         /*   your field can be compared   */
+         PFNCOMPARE pfnCompare;          /* Comparison function for this   */
+                                         /*   field. Can be NULL unless    */
+                                         /*   ownerdraw is used.           */
+         ULONG      DefaultComparison;   /* This is the default compare    */
+                                         /*   operator in the include      */
+                                         /*   page criteria dialog. (eg:   */
+                                         /*   CMP_LESS_OR_EQUAL)           */
+         ULONG      ulLenCompareValue;   /* Maximum length of the compare  */
+                                         /*   data. Can be NULL unless     */
+                                         /*   ownerdraw is used.           */
+         PVOID      pDefCompareValue;    /* The default value to be used   */
+                                         /*   for comparisons. Can be NULL */
+                                         /*   unless ownerdraw is used.    */
+         PVOID      pMinCompareValue;    /* The default value to be used   */
+                                         /*   for comparisons.Can be NULL  */
+                                         /*   unless ownerdraw is used.    */
+         PVOID      pMaxCompareValue;    /* The default value to be used   */
+                                         /*   for comparisons.Can be NULL  */
+                                         /*   unless ownerdraw is used.    */
+         PSZ        pszEditControlClass; /* Window class to be used to edit*/
+                                         /*   the compare value. Can be    */
+                                         /*   NULL unless ownerdraw is used*/
+         PFNCOMPARE pfnSort;             /* Sort function for this @SM09511*/
+                                         /*   field. Can be NULL unless    */
+                                         /*   ownerdraw is used.           */
+         PSZ        *pNewComp;
+      } CLASSFIELDINFO;
+
+      typedef CLASSFIELDINFO *PCLASSFIELDINFO;
+
+ #define CMP_EQUAL            0
+      #define CMP_GREATER          1
+      #define CMP_LESS             2
+      #define CMP_GREATER_OR_EQUAL 3
+      #define CMP_LESS_OR_EQUAL    4
+      #define CMP_NOT_EQUAL        5
+
+      #define NUM_CMP_VALUES       6
+
+
+      #define COMPARE_SUPPORTED      1
+      #define SORTBY_SUPPORTED       2
+
+      /* Standard notebook size constants */
+      #define STDNOTEBOOKWIDTH    290
+      #define STDNOTEBOOKHEIGHT   275
+
+      /* Confirm flags */
+      #define CONFIRM_DELETE             0x0001
+      #define CONFIRM_DELETEFOLDER       0x0002
+      #define CONFIRM_RENAMEFILESWITHEXT 0x0004
+      #define CONFIRM_KEEPASSOC          0x0008
+      #define CONFIRM_ACTION             0x0010
+      #define CONFIRM_PROGRESS           0x0020
+      #define CONFIRM_ALLOWFORCEDELETE   0x0040
+      #define CONFIRM_FORCEDELETE        0x0080
+
+      #define OK_DELETE             1
+      #define NO_DELETE             2
+      #define CANCEL_DELETE         3
+
+      #define NUM_OBJDETAILS_FIELDS    5     /* number of object details */
+
+      /* Search Type for wpclsQueryExtendedCriteria */
+
+      #define SEARCH_ALL_FOLDERS 1
+      #define SEARCH_THIS_FOLDER 2
+      #define SEARCH_THIS_TREE   3
+ 
+
+      /* Find method related types and constants */
+
+      typedef WPObject   *OBJECT;                             /* FIND */
+      typedef OBJECT     *POBJECT;
+      typedef M_WPObject *CLASS;
+      typedef CLASS      *PCLASS;
+      typedef LHANDLE     HFIND;
+      typedef HFIND      *PHFIND;
+
+     /*  Flags for the wpFilterPopupMenu() method */
+
+      #define CTXT_CRANOTHER     0x0001   /* Flags for ulFlags */
+      #define CTXT_NEW           CTXT_CRANOTHER
+      #define CTXT_OPEN          0x0002
+      #define CTXT_WINDOW        0x0004
+      #define CTXT_SWITCHTO      CTXT_WINDOW
+      #define CTXT_CLOSE         0x0008
+      #define CTXT_SETTINGS      0x0010
+      #define CTXT_PRINT         0x0020
+      #define CTXT_HELP          0x0040
+      #define CTXT_DELETE        0x0080
+      #define CTXT_COPY          0x0100
+      #define CTXT_MOVE          0x0200
+      #define CTXT_SHADOW        0x0400
+      #define CTXT_LINK          CTXT_SHADOW
+      #define CTXT_PROGRAM       0x0800
+      #define CTXT_ICON        0x001000
+      #define CTXT_TREE        0x002000
+      #define CTXT_DETAILS     0x004000
+      #define CTXT_FIND        0x008000
+      #define CTXT_SELECT      0x010000
+      #define CTXT_ARRANGE     0x020000
+      #define CTXT_SORT        0x040000
+      #define CTXT_SHUTDOWN    0x080000
+      #define CTXT_LOCKUP      0x100000
+      #define CTXT_PALETTE     0x200000
+      #define CTXT_REFRESH     0x400000
+      #define CTXT_PICKUP      0x800000              /*rme88844*/
+      #define CTXT_PUTDOWN        0x1000000          /*rme88844*/
+      #define CTXT_PUTDOWN_CANCEL 0x2000000          /*rme88844*/
+
+ 
+     /* Flags for the wpDisplayMenu() method */
+
+     #define MENU_OBJECTPOPUP          0x00000001
+     #define MENU_OPENVIEWPOPUP        0x00000002
+     #define MENU_TITLEBARPULLDOWN     0x00000003
+     #define MENU_TITLEBARPULLDOWNINT  0x00000004
+     #define MENU_USER                 0x80000000
+
+      /* common context menu ids */
+
+      #define WPMENUID_USER          0x6500
+      #define WPMENUID_PRIMARY            0
+      #define WPMENUID_OPEN               1
+      #define WPMENUID_HELP               2
+      #define WPMENUID_PRINT              3
+      #define WPMENUID_SELECT             4
+      #define WPMENUID_SORT               5
+      #define WPMENUID_TREE               123                                 /*DD 86092F*/  
+      #define WPMENUID_FIND               8                                   /*DD 86092F*/  
+      #define WPMENUID_CREATEANOTHER      101                                 /*DD 86092F*/  
+      #define WPMENUID_MOVE               107                                 /*DD 86092F*/  
+      #define WPMENUID_COPY               108                                 /*DD 86092F*/  
+      #define WPMENUID_DELETE             109                                 /*DD 86092F*/  
+      #define WPMENUID_PROPERTIES         112                                 /*DD 86092F*/  
+      #define WPMENUID_SELALL             114                                 /*DD 86092F*/  
+      #define WPMENUID_DESELALL           115                                 /*DD 86092F*/  
+      #define WPMENUID_RESERVED1          118                                 /*DD 86092F*/  
+      #define WPMENUID_CLOSE              120                                 /*DD 86092F*/  
+      #define WPMENUID_FORMAT             124                                 /*DD 86092F*/  
+      #define WPMENUID_CHKDSK             128                                 /*DD 86092F*/  
+      #define WPMENUID_FIXDSK             129                                 /*DD 86092F*/  
+      #define WPMENUID_PROGRAM            132                                 /*DD 86092F*/  
+      #define WPMENUID_COPYDSK            182                                 /*DD 86092F*/  
+      #define WPMENUID_LOCKDISK           184                                 /*DD 86092F*/  
+      #define WPMENUID_EJECTDISK          185                                 /*DD 86092F*/  
+      #define WPMENUID_UNLOCKDISK         186                                 /*DD 86092F*/  
+      #define WPMENUID_PICKUP             188                                 /* rme77131*/  
+      #define WPMENUID_PUTDOWN            189                                 /* rme77131*/  
+      #define WPMENUID_PUTDOWN_COPY       190                                 /* rme77131*/  
+      #define WPMENUID_PUTDOWN_MOVE       191                                 /* rme77131*/  
+      #define WPMENUID_PUTDOWN_LINK       192                                 /* rme77131*/  
+      #define WPMENUID_PUTDOWN_CANCEL     193                                 /* rme77131*/  
+      #define WPMENUID_PUTDOWN_CREATE     194                                 /* rme77131*/  
+      #define WPMENUID_ICON               303                                 /*DD 86092F*/  
+      #define WPMENUID_DETAILS            304                                 /*DD 86092F*/  
+      #define WPMENUID_ARRANGE            309                                 /*DD 86092F*/  
+      #define WPMENUID_RESERVED2          315                                 /*DD 86092F*/  
+      #define WPMENUID_CREATESHADOW       316                                 /*DD 86092F*/  
+      #define WPMENUID_PALETTE            317                                 /*DD 86092F*/  
+      #define WPMENUID_REFRESH            503                                 /*DD 86092F*/  
+      #define WPMENUID_HELP_FOR_HELP      601                                 /*DD 86092F*/  
+      #define WPMENUID_HOWTOGETHELP       601                                 /*DD 86092F*/  
+      #define WPMENUID_EXTENDEDHELP       602                                 /*DD 86092F*/  
+      #define WPMENUID_HELPKEYS           603                                 /*DD 86092F*/  
+      #define WPMENUID_HELPINDEX          604                                 /*DD 86092F*/  
+      #define WPMENUID_SHUTDOWN           704                                 /*DD 86092F*/  
+      #define WPMENUID_LOCKUP             705                                 /*DD 86092F*/  
+      #define WPMENUID_LOGIN              708                                 /*DD 86092F*/  
+      #define WPMENUID_LOGOUT             709                                 /*DD 86092F*/  
+      #define WPMENUID_ASSIGN             710                                 /*DD 86092F*/  
+      #define WPMENUID_UNASSIGN           711                                 /*DD 86092F*/  
+      #define WPMENUID_ACCESSNEW          712                                 /*DD 86092F*/  
+      #define WPMENUID_SYSTEMSETUP        713                                 /*DD 86092F*/  
+
+
+
+
+     /*  Open views for the wpOpen() method */
+
+      #define OPEN_UNKNOWN      -1
+      #define OPEN_DEFAULT       0
+      #define OPEN_CONTENTS      1
+      #define OPEN_SETTINGS      2
+      #define OPEN_HELP          3
+      #define OPEN_RUNNING       4
+      #define OPEN_PROMPTDLG     5
+      #define OPEN_PALETTE       121                                   /*SPLIT*/
+      #define OPEN_USER          0x6500
+
+
+    /* Macro to return the object associated with a given MINIRECORDCORE
+       * that was inserted using the wpCnrInsertObject method
+       */
+      #define OBJECT_FROM_PREC( prec )   ( (PVOID)( * (((PULONG)prec)-2) ) )
+
+      /* wpDrop method return code  */
+
+      #define RC_DROP_DROPCOMPLETE 2
+      #define RC_DROP_ITEMCOMPLETE 1
+      #define RC_DROP_RENDERING    0
+      #define RC_DROP_ERROR       -1
+
+
+
+#define VIEW_CONTENTS      0x00000001
+#define VIEW_SETTINGS      0x00000002
+#define VIEW_HELP          0x00000004
+#define VIEW_RUNNING       0x00000008
+#define VIEW_DETAILS       0x00000010
+#define VIEW_TREE          0x00000020
+#define VIEW_ANY           0xFFFFFFFF  /* Special case - will find any ViewItem */
+
+
+#include <som.hh>
+
+     #pragma SOMAsDefault(on)
+class SOMClass;
+     #pragma SOMAsDefault(pop)
+     #pragma SOMAsDefault(on)
+class SOMObject;
+     #pragma SOMAsDefault(pop)
+     #pragma SOMAsDefault(on)
+class WPFolder;
+     #pragma SOMAsDefault(pop)
+     #pragma SOMAsDefault(on)
+class M_WPObject;
+     #pragma SOMAsDefault(pop)
+     #pragma SOMAsDefault(on)
+class WPObject;
+     #pragma SOMAsDefault(pop)
+#include <somobj.hh>
+#pragma SOMNonDTS(on)
+
+
+#pragma SOMAsDefault(on)
+
+
+
+/********************************************/
+
+
+
+
+/*********** From WPObject.h ******************/
+/*
+ * External name shortening if required
+ */
+#ifdef SOM_USE_SHORT_EXTERNAL_NAMES
+#define WPObjectNewClass wpobjc
+#pragma linkage(wpobjc, system)
+#define WPObjectClassData wpobjd
+#define WPObjectCClassData wpobjx
+#endif /* SOM_USE_SHORT_EXTERNAL_NAMES */
+
+#ifndef SOM_Resolve
+
+#define somresolve_(obj,mToken) (somResolve(obj,mToken))
+
+/* from oc's mtbl, with verification of o */
+#define SOM_Resolve(o, ocn, mn) \
+    (( somTD_ ## ocn ## _ ## mn ) \
+     somresolve_(SOM_TestCls(o, ocn ## ClassData.classObject), \
+                ocn ## ClassData.mn ))
+#endif
+
+#define WPObject_classObj WPObjectClassData.classObject
+#define _WPObject WPObject_classObj
+
+/*
+ * Declare the class creation procedure
+ */
+SOMEXTERN SOMClass * SOMLINK WPObjectNewClass(integer4 somtmajorVersion,
+		integer4 somtminorVersion);
+
+/*
+ * Declare the class data structure
+ */
+SOMEXTERN struct WPObjectClassDataStructure {
+	SOMClass *classObject;
+	somMToken wpSetTitle;
+	somMToken wpQueryTitle;
+	somMToken wpSetStyle;
+	somMToken wpQueryStyle;
+	somMToken wpSetIcon;
+	somMToken wpQueryIcon;
+	somMToken wpSetFolder;
+	somMToken wpQueryFolder;
+	somMToken wpObjectPrivate1;
+	somMToken wpObjectPrivate2;
+	somMToken wpSetDefaultView;
+	somMToken wpQueryDefaultView;
+	somMToken wpObjectPrivate3;
+	somMToken wpSaveState;
+	somMToken wpObjectPrivate4;
+	somMToken wpObjectPrivate5;
+	somMToken wpSaveLong;
+	somMToken wpSaveString;
+	somMToken wpSaveData;
+	somMToken wpObjectPrivate6;
+	somMToken wpRestoreState;
+	somMToken wpObjectPrivate7;
+	somMToken wpObjectPrivate8;
+	somMToken wpRestoreLong;
+	somMToken wpRestoreString;
+	somMToken wpRestoreData;
+	somMToken wpObjectPrivate9;
+	somMToken wpAllocMem;
+	somMToken wpFreeMem;
+	somMToken wpAddToObjUseList;
+	somMToken wpDeleteFromObjUseList;
+	somMToken wpFindUseItem;
+	somMToken wpSwitchTo;
+	somMToken withdrawn1;
+	somMToken wpFilterPopupMenu;
+	somMToken wpModifyPopupMenu;
+	somMToken wpMenuItemSelected;
+	somMToken wpFormatDragItem;
+	somMToken wpDrop;
+	somMToken wpDragOver;
+	somMToken wpRender;
+	somMToken wpEndConversation;
+	somMToken withdrawn10;
+	somMToken wpObjectPrivate10;
+	somMToken wpObjectPrivate11;
+	somMToken wpFree;
+	somMToken wpCopiedFromTemplate;
+	somMToken wpAddSettingsPages;
+	somMToken wpAddObjectGeneralPage;
+	somMToken wpDisplayHelp;
+	somMToken wpMenuItemHelpSelected;
+	somMToken wpInsertSettingsPage;
+	somMToken wpInsertPopupMenuItems;
+	somMToken withdrawn5;
+	somMToken withdrawn6;
+	somMToken withdrawn4;
+	somMToken withdrawn3;
+	somMToken wpCnrInsertObject;
+	somMToken wpCnrRemoveObject;
+	somMToken wpInitData;
+	somMToken wpUnInitData;
+	somMToken wpSetup;
+	somMToken wpScanSetupString;
+	somMToken wpSaveImmediate;
+	somMToken wpOpen;
+	somMToken wpClose;
+	somMToken wpHide;
+	somMToken wpRestore;
+	somMToken wpSetIconData;
+	somMToken wpQueryIconData;
+	somMToken wpObjectPrivate12;
+	somMToken wpDelete;
+	somMToken wpConfirmDelete;
+	somMToken withdrawn2;
+	somMToken withdrawn11;
+	somMToken withdrawn7;
+	somMToken wpRegisterView;
+	somMToken wpIdentify;
+	somMToken wpSetDefaultHelp;
+	somMToken wpQueryDefaultHelp;
+	somMToken wpDoesObjectMatch;
+	somMToken wpCnrRefreshDetails;
+	somMToken wpSetError;
+	somMToken wpQueryError;
+	somMToken wpDraggedOverObject;
+	somMToken wpDroppedOnObject;
+	somMToken wpSetDefaultIconPos;
+	somMToken wpQueryDefaultIconPos;
+	somMToken wpObjectPrivate13;
+	somMToken wpObjectPrivate14;
+	somMToken wpSetObjectID;
+	somMToken wpQueryObjectID;
+	somMToken wpIsDeleteable;
+	somMToken wpQueryHandle;
+	somMToken wpSaveDeferred;
+	somMToken wpAddObjectWindowPage;
+	somMToken wpQueryConcurrentView;
+	somMToken wpSetConcurrentView;
+	somMToken wpQueryMinWindow;
+	somMToken wpSetMinWindow;
+	somMToken wpViewObject;
+	somMToken wpQueryButtonAppearance;
+	somMToken wpSetButtonAppearance;
+	somMToken wpQueryConfirmations;
+	somMToken wpCnrSetEmphasis;
+	somMToken wpQueryCoreRecord;
+	somMToken wpFindViewItem;
+	somMToken wpCreateFromTemplate;
+	somMethodProc *wpQueryTrueStyle;
+	somMToken wpAssertObjectMutexSem;
+	somMToken wpReleaseObjectMutexSem;
+	somMToken wpRequestObjectMutexSem;
+	somMToken wpCreateAnother;
+	somMToken wpCreateShadowObject;
+	somMToken wpCopyObject;
+	somMToken wpMoveObject;
+	somMToken wpLockObject;
+	somMToken wpUnlockObject;
+	somMToken wpIsLocked;
+	somMToken wpRenderComplete;
+	somMToken wpQueryDetailsData;
+	somMToken wpPrintObject;
+	somMToken wpObjectPrivate15;
+	somMToken wpSetTaskRec;
+	somMToken wpObjectPrivate16;
+	somMToken wpModifyStyle;
+	somMToken wpObjectPrivate17;
+	somMToken wpFindTaskRec;
+	somMToken wpAppendObject;
+	somMToken wpReplaceObject;
+	somMToken wpQueryNameClashOptions;
+	somMToken wpConfirmObjectTitle;
+	somMToken _get_pobjNext;
+	somMToken wpQueryContainerFlagPtr;
+	somMToken wpObjectPrivate18;
+	somMToken wpObjectPrivate19;
+	somMToken wpObjectPrivate20;
+	somMToken wpCnrDeleteUseItem;
+	somMToken wpObjectReady;
+	somMToken wpIsObjectInitialized;
+	somMToken wpCreateShadowObjectExt;
+	somMToken wpObjectPrivate21;
+	somMToken wpObjectPrivate22;
+	somMToken wpObjectPrivate26;
+	somMToken wpDisplayMenu;
+	somMToken wpWaitForClose;
+	somMToken wpQueryScreenGroupID;
+	somMToken wpSetupOnce;
+	somMToken wpAddObjectGeneralPage2;
+	somMToken wpObjectPrivate23;
+	somMToken wpObjectPrivate24;
+	somMToken wpModifyMenu;
+	somMToken wpFilterMenu;
+	somMToken wpInsertMenuItems;
+	somMToken wpSetMenuStyle;
+	somMToken wpQueryMenuStyle;
+	somMToken wpObjectPrivate27;
+	somMToken wpObjectPrivate28;
+	somMToken wpObjectPrivate29;
+	somMToken wpObjectPrivate30;
+	somMToken wpQueryOpenView;
+	somMToken wpSetOpenView;
+	somMToken wpObjectPrivate31;
+	somMToken wpObjectPrivate32;
+	somMToken wpObjectPrivate33;
+} SOMDLINK WPObjectClassData;
+
+/*
+ * Declare the C specific class data structure
+ */
+SOMEXTERN struct WPObjectCClassDataStructure {
+	somMethodTabs parentMtab;
+	somDToken instanceDataToken;
+} SOMDLINK WPObjectCClassData;
+
+
+/*
+ * New and Renew macros for WPObject
+ */
+#define WPObjectNew() \
+   (_somNew(_WPObject ? _WPObject : WPObjectNewClass(WPObject_MajorVersion, WPObject_MinorVersion)))
+#define WPObjectRenew(buf) \
+   (_somRenew(_WPObject ? _WPObject : WPObjectNewClass(WPObject_MajorVersion, WPObject_MinorVersion), buf))
+
+/*
+ * Override method: somInit
+ */
+#define WPObject_somInit(somSelf) \
+	SOMObject_somInit(somSelf)
+
+/*
+ * Override method: somUninit
+ */
+#define WPObject_somUninit(somSelf) \
+	SOMObject_somUninit(somSelf)
+
+/*
+ * Override method: somDefaultInit
+ */
+#define WPObject_somDefaultInit(somSelf,ctrl) \
+	SOMObject_somDefaultInit(somSelf,ctrl)
+
+/*
+ * Override method: somDestruct
+ */
+#define WPObject_somDestruct(somSelf,doFree,ctrl) \
+	SOMObject_somDestruct(somSelf,doFree,ctrl)
+
+/*
+ * New Method: wpAddSettingsPages, inserted by CW
+ */
+typedef ULONG   SOMLINK somTP_WPObject_wpAddSettingsPages(WPObject *somSelf,
+		HWND hwndNotebook);
+//#pragma linkage(somTP_WPObject_wpAddSettingsPages, system)
+typedef somTP_WPObject_wpAddSettingsPages *somTD_WPObject_wpAddSettingsPages;
+#define somMD_WPObject_wpAddSettingsPages "::WPObject::wpAddSettingsPages"
+#define WPObject_wpAddSettingsPages(somSelf,hwndNotebook) \
+    (SOM_Resolve(somSelf, WPObject, wpAddSettingsPages) \
+	(somSelf,hwndNotebook))
+#ifndef SOMGD_wpAddSettingsPages
+    #if (defined(_wpAddSettingsPages) || defined(__wpAddSettingsPages))
+        #undef _wpAddSettingsPages
+        #undef __wpAddSettingsPages
+        #define SOMGD_wpAddSettingsPages 1
+    #else
+        #define _wpAddSettingsPages WPObject_wpAddSettingsPages
+    #endif /* _wpAddSettingsPages */
+#endif /* SOMGD_wpAddSettingsPages */
+
+/*
+ * New Method: wpClose
+ */
+typedef BOOL   SOMLINK somTP_WPObject_wpClose(WPObject *somSelf);
+//#pragma linkage(somTP_WPObject_wpClose, system)
+typedef somTP_WPObject_wpClose *somTD_WPObject_wpClose;
+#define somMD_WPObject_wpClose "::WPObject::wpClose"
+#define WPObject_wpClose(somSelf) \
+    (SOM_Resolve(somSelf, WPObject, wpClose) \
+	(somSelf))
+#ifndef SOMGD_wpClose
+    #if (defined(_wpClose) || defined(__wpClose))
+        #undef _wpClose
+        #undef __wpClose
+        #define SOMGD_wpClose 1
+    #else
+        #define _wpClose WPObject_wpClose
+    #endif /* _wpClose */
+#endif /* SOMGD_wpClose */
+
+
+/*
+ * New Method: wpDelete
+ */
+typedef ULONG   SOMLINK somTP_WPObject_wpDelete(WPObject *somSelf,
+		ULONG fConfirmations);
+//#pragma linkage(somTP_WPObject_wpDelete, system)
+typedef somTP_WPObject_wpDelete *somTD_WPObject_wpDelete;
+#define somMD_WPObject_wpDelete "::WPObject::wpDelete"
+#define WPObject_wpDelete(somSelf,fConfirmations) \
+    (SOM_Resolve(somSelf, WPObject, wpDelete) \
+	(somSelf,fConfirmations))
+#ifndef SOMGD_wpDelete
+    #if (defined(_wpDelete) || defined(__wpDelete))
+        #undef _wpDelete
+        #undef __wpDelete
+        #define SOMGD_wpDelete 1
+    #else
+        #define _wpDelete WPObject_wpDelete
+    #endif /* _wpDelete */
+#endif /* SOMGD_wpDelete */
+
+/*
+ * New Method: wpFilterPopupMenu, inserted by CW
+ */
+typedef ULONG   SOMLINK somTP_WPObject_wpFilterPopupMenu(WPObject *somSelf,
+		ULONG ulFlags,
+		HWND hwndCnr,
+		BOOL fMultiSelect);
+//#pragma linkage(somTP_WPObject_wpFilterPopupMenu, system)
+typedef somTP_WPObject_wpFilterPopupMenu *somTD_WPObject_wpFilterPopupMenu;
+#define somMD_WPObject_wpFilterPopupMenu "::WPObject::wpFilterPopupMenu"
+#define WPObject_wpFilterPopupMenu(somSelf,ulFlags,hwndCnr,fMultiSelect) \
+    (SOM_Resolve(somSelf, WPObject, wpFilterPopupMenu) \
+	(somSelf,ulFlags,hwndCnr,fMultiSelect))
+#ifndef SOMGD_wpFilterPopupMenu
+    #if (defined(_wpFilterPopupMenu) || defined(__wpFilterPopupMenu))
+        #undef _wpFilterPopupMenu
+        #undef __wpFilterPopupMenu
+        #define SOMGD_wpFilterPopupMenu 1
+    #else
+        #define _wpFilterPopupMenu WPObject_wpFilterPopupMenu
+    #endif /* _wpFilterPopupMenu */
+#endif /* SOMGD_wpFilterPopupMenu */
+
+
+
+/*
+ * New Method: wpInitData, inserted by CW
+ */
+typedef ULONG   SOMLINK somTP_WPObject_wpInitData(WPObject *somSelf);
+//#pragma linkage(somTP_WPObject_wpInitData, system)
+typedef somTP_WPObject_wpInitData *somTD_WPObject_wpInitData;
+#define somMD_WPObject_wpInitData "::WPObject::wpInitData"
+#define WPObject_wpInitData(somSelf) \
+    (SOM_Resolve(somSelf, WPObject, wpInitData) \
+	(somSelf))
+#ifndef SOMGD_wpInitData
+    #if (defined(_wpInitData) || defined(__wpInitData))
+        #undef _wpInitData
+        #undef __wpInitData
+        #define SOMGD_wpInitData 1
+    #else
+        #define _wpInitData WPObject_wpInitData
+    #endif /* _wpInitData */
+#endif /* SOMGD_wpInitData */
+
+/*
+ * New Method: wpOpen, inserted by CW
+ */
+typedef HWND   SOMLINK somTP_WPObject_wpOpen(WPObject *somSelf,
+		HWND hwndCnr,
+		ULONG ulView,
+		ULONG param);
+//#pragma linkage(somTP_WPObject_wpOpen, system)
+typedef somTP_WPObject_wpOpen *somTD_WPObject_wpOpen;
+#define somMD_WPObject_wpOpen "::WPObject::wpOpen"
+#define WPObject_wpOpen(somSelf,hwndCnr,ulView,param) \
+    (SOM_Resolve(somSelf, WPObject, wpOpen) \
+	(somSelf,hwndCnr,ulView,param))
+#ifndef SOMGD_wpOpen
+    #if (defined(_wpOpen) || defined(__wpOpen))
+        #undef _wpOpen
+        #undef __wpOpen
+        #define SOMGD_wpOpen 1
+    #else
+        #define _wpOpen WPObject_wpOpen
+    #endif /* _wpOpen */
+#endif /* SOMGD_wpOpen */
+
+/*
+ * New Method: wpInsertSettingsPage (CW)
+ */
+typedef ULONG   SOMLINK somTP_WPObject_wpInsertSettingsPage(WPObject *somSelf,
+		HWND hwndNotebook,
+		PPAGEINFO ppageinfo);
+//#pragma linkage(somTP_WPObject_wpInsertSettingsPage, system)
+typedef somTP_WPObject_wpInsertSettingsPage *somTD_WPObject_wpInsertSettingsPage;
+#define somMD_WPObject_wpInsertSettingsPage "::WPObject::wpInsertSettingsPage"
+#define WPObject_wpInsertSettingsPage(somSelf,hwndNotebook,ppageinfo) \
+    (SOM_Resolve(somSelf, WPObject, wpInsertSettingsPage) \
+	(somSelf,hwndNotebook,ppageinfo))
+#ifndef SOMGD_wpInsertSettingsPage
+    #if (defined(_wpInsertSettingsPage) || defined(__wpInsertSettingsPage))
+        #undef _wpInsertSettingsPage
+        #undef __wpInsertSettingsPage
+        #define SOMGD_wpInsertSettingsPage 1
+    #else
+        #define _wpInsertSettingsPage WPObject_wpInsertSettingsPage
+    #endif /* _wpInsertSettingsPage */
+#endif /* SOMGD_wpInsertSettingsPage */
+
+/*
+ * New Method: wpRestoreState
+ */
+typedef BOOL   SOMLINK somTP_WPObject_wpRestoreState(WPObject *somSelf,
+		ULONG ulReserved);
+//#pragma linkage(somTP_WPObject_wpRestoreState, system)
+typedef somTP_WPObject_wpRestoreState *somTD_WPObject_wpRestoreState;
+#define somMD_WPObject_wpRestoreState "::WPObject::wpRestoreState"
+#define WPObject_wpRestoreState(somSelf,ulReserved) \
+    (SOM_Resolve(somSelf, WPObject, wpRestoreState) \
+	(somSelf,ulReserved))
+#ifndef SOMGD_wpRestoreState
+    #if (defined(_wpRestoreState) || defined(__wpRestoreState))
+        #undef _wpRestoreState
+        #undef __wpRestoreState
+        #define SOMGD_wpRestoreState 1
+    #else
+        #define _wpRestoreState WPObject_wpRestoreState
+    #endif /* _wpRestoreState */
+#endif /* SOMGD_wpRestoreState */
+
+/*
+ * New Method: wpSaveState
+ */
+typedef BOOL   SOMLINK somTP_WPObject_wpSaveState(WPObject *somSelf);
+//#pragma linkage(somTP_WPObject_wpSaveState, system)
+typedef somTP_WPObject_wpSaveState *somTD_WPObject_wpSaveState;
+#define somMD_WPObject_wpSaveState "::WPObject::wpSaveState"
+#define WPObject_wpSaveState(somSelf) \
+    (SOM_Resolve(somSelf, WPObject, wpSaveState) \
+	(somSelf))
+#ifndef SOMGD_wpSaveState
+    #if (defined(_wpSaveState) || defined(__wpSaveState))
+        #undef _wpSaveState
+        #undef __wpSaveState
+        #define SOMGD_wpSaveState 1
+    #else
+        #define _wpSaveState WPObject_wpSaveState
+    #endif /* _wpSaveState */
+#endif /* SOMGD_wpSaveState */
+
+/*
+ * New Method: wpSetupOnce
+ */
+typedef BOOL   SOMLINK somTP_WPObject_wpSetupOnce(WPObject *somSelf,
+		PSZ pszSetupString);
+//#pragma linkage(somTP_WPObject_wpSetupOnce, system)
+typedef somTP_WPObject_wpSetupOnce *somTD_WPObject_wpSetupOnce;
+#define somMD_WPObject_wpSetupOnce "::WPObject::wpSetupOnce"
+#define WPObject_wpSetupOnce(somSelf,pszSetupString) \
+    (SOM_Resolve(somSelf, WPObject, wpSetupOnce) \
+	(somSelf,pszSetupString))
+#ifndef SOMGD_wpSetupOnce
+    #if (defined(_wpSetupOnce) || defined(__wpSetupOnce))
+        #undef _wpSetupOnce
+        #undef __wpSetupOnce
+        #define SOMGD_wpSetupOnce 1
+    #else
+        #define _wpSetupOnce WPObject_wpSetupOnce
+    #endif /* _wpSetupOnce */
+#endif /* SOMGD_wpSetupOnce */
+
+
+/*
+ * New Method: wpUnInitData
+ */
+typedef void   SOMLINK somTP_WPObject_wpUnInitData(WPObject *somSelf);
+//#pragma linkage(somTP_WPObject_wpUnInitData, system)
+typedef somTP_WPObject_wpUnInitData *somTD_WPObject_wpUnInitData;
+#define somMD_WPObject_wpUnInitData "::WPObject::wpUnInitData"
+#define WPObject_wpUnInitData(somSelf) \
+    (SOM_Resolve(somSelf, WPObject, wpUnInitData) \
+	(somSelf))
+#ifndef SOMGD_wpUnInitData
+    #if (defined(_wpUnInitData) || defined(__wpUnInitData))
+        #undef _wpUnInitData
+        #undef __wpUnInitData
+        #define SOMGD_wpUnInitData 1
+    #else
+        #define _wpUnInitData WPObject_wpUnInitData
+    #endif /* _wpUnInitData */
+#endif /* SOMGD_wpUnInitData */
+
+/*
+ * New Method: wpMenuItemSelected
+ */
+typedef BOOL   SOMLINK somTP_WPObject_wpMenuItemSelected(WPObject *somSelf,
+		HWND hwndFrame,
+		ULONG ulMenuId);
+//#pragma linkage(somTP_WPObject_wpMenuItemSelected, system)
+typedef somTP_WPObject_wpMenuItemSelected *somTD_WPObject_wpMenuItemSelected;
+#define somMD_WPObject_wpMenuItemSelected "::WPObject::wpMenuItemSelected"
+#define WPObject_wpMenuItemSelected(somSelf,hwndFrame,ulMenuId) \
+    (SOM_Resolve(somSelf, WPObject, wpMenuItemSelected) \
+	(somSelf,hwndFrame,ulMenuId))
+#ifndef SOMGD_wpMenuItemSelected
+    #if (defined(_wpMenuItemSelected) || defined(__wpMenuItemSelected))
+        #undef _wpMenuItemSelected
+        #undef __wpMenuItemSelected
+        #define SOMGD_wpMenuItemSelected 1
+    #else
+        #define _wpMenuItemSelected WPObject_wpMenuItemSelected
+    #endif /* _wpMenuItemSelected */
+#endif /* SOMGD_wpMenuItemSelected */
+
+
+
+/*
+ * New Method: wpModifyPopupMenu
+ */
+typedef BOOL   SOMLINK somTP_WPObject_wpModifyPopupMenu(WPObject *somSelf,
+		HWND hwndMenu,
+		HWND hwndCnr,
+		ULONG iPosition);
+//#pragma linkage(somTP_WPObject_wpModifyPopupMenu, system)
+typedef somTP_WPObject_wpModifyPopupMenu *somTD_WPObject_wpModifyPopupMenu;
+#define somMD_WPObject_wpModifyPopupMenu "::WPObject::wpModifyPopupMenu"
+#define WPObject_wpModifyPopupMenu(somSelf,hwndMenu,hwndCnr,iPosition) \
+    (SOM_Resolve(somSelf, WPObject, wpModifyPopupMenu) \
+	(somSelf,hwndMenu,hwndCnr,iPosition))
+#ifndef SOMGD_wpModifyPopupMenu
+    #if (defined(_wpModifyPopupMenu) || defined(__wpModifyPopupMenu))
+        #undef _wpModifyPopupMenu
+        #undef __wpModifyPopupMenu
+        #define SOMGD_wpModifyPopupMenu 1
+    #else
+        #define _wpModifyPopupMenu WPObject_wpModifyPopupMenu
+    #endif /* _wpModifyPopupMenu */
+#endif /* SOMGD_wpModifyPopupMenu */
+
+/*
+ * New Method: wpSetup
+ */
+typedef BOOL   SOMLINK somTP_WPObject_wpSetup(WPObject *somSelf,
+		PSZ pszSetupString);
+//#pragma linkage(somTP_WPObject_wpSetup, system)
+typedef somTP_WPObject_wpSetup *somTD_WPObject_wpSetup;
+#define somMD_WPObject_wpSetup "::WPObject::wpSetup"
+#define WPObject_wpSetup(somSelf,pszSetupString) \
+    (SOM_Resolve(somSelf, WPObject, wpSetup) \
+	(somSelf,pszSetupString))
+#ifndef SOMGD_wpSetup
+    #if (defined(_wpSetup) || defined(__wpSetup))
+        #undef _wpSetup
+        #undef __wpSetup
+        #define SOMGD_wpSetup 1
+    #else
+        #define _wpSetup WPObject_wpSetup
+    #endif /* _wpSetup */
+#endif /* SOMGD_wpSetup */
+
+/*
+ * New Method: wpViewObject, adapted and inserted by CW (copied from wpobject.h)
+ */
+
+typedef HWND   SOMLINK somTP_WPObject_wpViewObject(WPObject *somSelf,
+		HWND hwndCnr,
+		ULONG ulView,
+		ULONG param);
+//#pragma linkage(somTP_WPObject_wpViewObject, system) //comment by CW
+typedef somTP_WPObject_wpViewObject *somTD_WPObject_wpViewObject;
+#define somMD_WPObject_wpViewObject "::WPObject::wpViewObject"
+#define WPObject_wpViewObject(somSelf,hwndCnr,ulView,param) \
+    (SOM_Resolve(somSelf, WPObject, wpViewObject) \
+	(somSelf,hwndCnr,ulView,param))
+#ifndef SOMGD_wpViewObject
+    #if (defined(_wpViewObject) || defined(__wpViewObject))
+        #undef _wpViewObject
+        #undef __wpViewObject
+        #define SOMGD_wpViewObject 1
+    #else
+        #define _wpViewObject WPObject_wpViewObject
+    #endif /* _wpViewObject */
+#endif /* SOMGD_wpViewObject */
+
+/*
+ * New Method: wpCreateShadowObjectExt
+ */
+typedef WPObject*   SOMLINK somTP_WPObject_wpCreateShadowObjectExt(WPObject *somSelf,
+		WPFolder* Folder,
+		BOOL fLock,
+		PSZ pszSetup,
+		M_WPObject* shadowClass);
+//#pragma linkage(somTP_WPObject_wpCreateShadowObjectExt, system)
+typedef somTP_WPObject_wpCreateShadowObjectExt *somTD_WPObject_wpCreateShadowObjectExt;
+#define somMD_WPObject_wpCreateShadowObjectExt "::WPObject::wpCreateShadowObjectExt"
+#define WPObject_wpCreateShadowObjectExt(somSelf,Folder,fLock,pszSetup,shadowClass) \
+    (SOM_Resolve(somSelf, WPObject, wpCreateShadowObjectExt) \
+	(somSelf,Folder,fLock,pszSetup,shadowClass))
+#ifndef SOMGD_wpCreateShadowObjectExt
+    #if (defined(_wpCreateShadowObjectExt) || defined(__wpCreateShadowObjectExt))
+        #undef _wpCreateShadowObjectExt
+        #undef __wpCreateShadowObjectExt
+        #define SOMGD_wpCreateShadowObjectExt 1
+    #else
+        #define _wpCreateShadowObjectExt WPObject_wpCreateShadowObjectExt
+    #endif /* _wpCreateShadowObjectExt */
+#endif /* SOMGD_wpCreateShadowObjectExt */
+
+
+/*
+ * New Method: wpCopiedFromTemplate
+ */
+typedef void   SOMLINK somTP_WPObject_wpCopiedFromTemplate(WPObject *somSelf);
+//#pragma linkage(somTP_WPObject_wpCopiedFromTemplate, system)
+typedef somTP_WPObject_wpCopiedFromTemplate *somTD_WPObject_wpCopiedFromTemplate;
+#define somMD_WPObject_wpCopiedFromTemplate "::WPObject::wpCopiedFromTemplate"
+#define WPObject_wpCopiedFromTemplate(somSelf) \
+    (SOM_Resolve(somSelf, WPObject, wpCopiedFromTemplate) \
+	(somSelf))
+#ifndef SOMGD_wpCopiedFromTemplate
+    #if (defined(_wpCopiedFromTemplate) || defined(__wpCopiedFromTemplate))
+        #undef _wpCopiedFromTemplate
+        #undef __wpCopiedFromTemplate
+        #define SOMGD_wpCopiedFromTemplate 1
+    #else
+        #define _wpCopiedFromTemplate WPObject_wpCopiedFromTemplate
+    #endif /* _wpCopiedFromTemplate */
+#endif /* SOMGD_wpCopiedFromTemplate */
+
+/*
+ * New Method: wpDrop
+ */
+typedef MRESULT   SOMLINK somTP_WPObject_wpDrop(WPObject *somSelf, 
+		HWND hwndCnr, 
+		PDRAGINFO pdrgInfo, 
+		PDRAGITEM pdrgItem);
+//#pragma linkage(somTP_WPObject_wpDrop, system)
+typedef somTP_WPObject_wpDrop *somTD_WPObject_wpDrop;
+#define somMD_WPObject_wpDrop "::WPObject::wpDrop"
+#define WPObject_wpDrop(somSelf,hwndCnr,pdrgInfo,pdrgItem) \
+    (SOM_Resolve(somSelf, WPObject, wpDrop) \
+	(somSelf,hwndCnr,pdrgInfo,pdrgItem))
+#ifndef SOMGD_wpDrop
+    #if (defined(_wpDrop) || defined(__wpDrop))
+        #undef _wpDrop
+        #undef __wpDrop
+        #define SOMGD_wpDrop 1
+    #else
+        #define _wpDrop WPObject_wpDrop
+    #endif /* _wpDrop */
+#endif /* SOMGD_wpDrop */
+
+/*
+ * New Method: wpQueryDetailsData
+ */
+typedef ULONG   SOMLINK somTP_WPObject_wpQueryDetailsData(WPObject *somSelf,
+		PVOID* ppDetailsData,
+		PULONG pcp);
+//#pragma linkage(somTP_WPObject_wpQueryDetailsData, system)
+typedef somTP_WPObject_wpQueryDetailsData *somTD_WPObject_wpQueryDetailsData;
+#define somMD_WPObject_wpQueryDetailsData "::WPObject::wpQueryDetailsData"
+#define WPObject_wpQueryDetailsData(somSelf,ppDetailsData,pcp) \
+    (SOM_Resolve(somSelf, WPObject, wpQueryDetailsData) \
+	(somSelf,ppDetailsData,pcp))
+#ifndef SOMGD_wpQueryDetailsData
+    #if (defined(_wpQueryDetailsData) || defined(__wpQueryDetailsData))
+        #undef _wpQueryDetailsData
+        #undef __wpQueryDetailsData
+        #define SOMGD_wpQueryDetailsData 1
+    #else
+        #define _wpQueryDetailsData WPObject_wpQueryDetailsData
+    #endif /* _wpQueryDetailsData */
+#endif /* SOMGD_wpQueryDetailsData */
+
+
+
+#ifndef SOM_DONT_USE_INHERITED_MACROS
+#define WPObject_somDefaultCopyInit SOMObject_somDefaultCopyInit
+#define WPObject_somDefaultAssign SOMObject_somDefaultAssign
+#define WPObject_somDefaultConstCopyInit SOMObject_somDefaultConstCopyInit
+#define WPObject_somDefaultVCopyInit SOMObject_somDefaultVCopyInit
+#define WPObject_somDefaultConstVCopyInit SOMObject_somDefaultConstVCopyInit
+#define WPObject_somDefaultConstAssign SOMObject_somDefaultConstAssign
+#define WPObject_somDefaultVAssign SOMObject_somDefaultVAssign
+#define WPObject_somDefaultConstVAssign SOMObject_somDefaultConstVAssign
+#define WPObject_somFree SOMObject_somFree
+#define WPObject_somGetClass SOMObject_somGetClass
+#define WPObject_somGetClassName SOMObject_somGetClassName
+#define WPObject_somGetSize SOMObject_somGetSize
+#define WPObject_somIsA SOMObject_somIsA
+#define WPObject_somIsInstanceOf SOMObject_somIsInstanceOf
+#define WPObject_somRespondsTo SOMObject_somRespondsTo
+#define WPObject_somDispatch SOMObject_somDispatch
+#define WPObject_somClassDispatch SOMObject_somClassDispatch
+#define WPObject_somCastObj SOMObject_somCastObj
+#define WPObject_somResetObj SOMObject_somResetObj
+#define WPObject_somDispatchV SOMObject_somDispatchV
+#define WPObject_somDispatchL SOMObject_somDispatchL
+#define WPObject_somDispatchA SOMObject_somDispatchA
+#define WPObject_somDispatchD SOMObject_somDispatchD
+#define WPObject_somPrintSelf SOMObject_somPrintSelf
+#define WPObject_somDumpSelf SOMObject_somDumpSelf
+#define WPObject_somDumpSelfInt SOMObject_somDumpSelfInt
+#endif /* SOM_DONT_USE_INHERITED_MACROS */
+
+
+
+/************ End from WPObject.h **************/
+
+#pragma SOMAsDefault(on)
+class WPObject : public SOMObject {
+
+	#pragma SOMClassName(*, "WPObject")
+	#pragma SOMNoMangling(*)
+	#pragma SOMNonDTS(*)
+
+     #pragma SOMClassName (WPObject, "WPObject")
+  /* #pragma SOMMetaClass (WPObject, "M_WPObject")  */
+     #pragma SOMClassVersion (WPObject, 1, 2)
+     #pragma SOMCallstyle (oidl)
+     #pragma SOMAsDefault(off)
+     #pragma SOMAsDefault(pop)
+  public :
+     virtual ULONG wpAddObjectGeneralPage(HWND hwndNotebook);
+     virtual ULONG wpAddObjectGeneralPage2(HWND hwndNotebook);
+     virtual ULONG wpAddObjectWindowPage(HWND hwndNotebook);
+     virtual BOOL wpAddSettingsPages(HWND hwndNotebook);
+     virtual BOOL wpAddToObjUseList(PUSEITEM pUseItem);
+     virtual PBYTE wpAllocMem(ULONG cbBytes, PULONG prc);
+     virtual BOOL32 wpAppendObject(WPObject* targetObject, BOOL32 fMove);
+     virtual BOOL wpAssertObjectMutexSem();
+     virtual BOOL wpClose();
+     virtual PMINIRECORDCORE wpCnrInsertObject(HWND hwndCnr, 
+                                               PPOINTL pptlIcon, 
+                                               PMINIRECORDCORE preccParent, 
+                                               PRECORDINSERT pRecInsert);
+     virtual BOOL wpCnrRemoveObject(HWND hwndCnr);
+     virtual BOOL wpCnrSetEmphasis(ULONG ulEmphasisAttr, BOOL fTurnOn);
+     virtual ULONG wpConfirmDelete(ULONG fConfirmations);
+     virtual ULONG wpConfirmObjectTitle(WPFolder* Folder, WPObject** ppDuplicate, 
+                                        PSZ pszTitle, ULONG cbTitle, 
+                                        ULONG menuID);
+     virtual void wpCopiedFromTemplate();
+     virtual WPObject* wpCopyObject(WPFolder* Folder, BOOL fLock);
+     virtual WPObject* wpCreateAnother(PSZ pszTitle, PSZ pszSetupEnv, 
+                                       WPFolder* Folder);
+     virtual WPObject* wpCreateFromTemplate(WPFolder* folder, 
+                                            BOOL fLock);
+     virtual WPObject* wpCreateShadowObject(WPFolder* Folder, 
+                                            BOOL fLock);
+     virtual ULONG wpDelete(ULONG fConfirmations);
+     virtual BOOL wpDeleteFromObjUseList(PUSEITEM pUseItem);
+     virtual BOOL wpDisplayHelp(ULONG HelpPanelId, PSZ HelpLibrary);
+     virtual HWND wpDisplayMenu(HWND hwndOwner, HWND hwndClient, 
+                                POINTL* ptlPopupPt, ULONG ulMenuType, 
+                                ULONG ulReserved);
+     virtual BOOL wpDoesObjectMatch(PVOID pvoidExtendedCriteria);
+     virtual MRESULT wpDraggedOverObject(WPObject* DraggedOverObject);
+     virtual MRESULT wpDragOver(HWND hwndCnr, PDRAGINFO pdrgInfo);
+     virtual MRESULT wpDrop(HWND hwndCnr, PDRAGINFO pdrgInfo, 
+                            PDRAGITEM pdrgItem);
+     virtual BOOL wpDroppedOnObject(WPObject* DroppedOnObject);
+     virtual MRESULT wpEndConversation(ULONG ulItemID, ULONG flResult);
+     virtual ULONG wpFilterPopupMenu(ULONG ulFlags, HWND hwndCnr, 
+                                     BOOL fMultiSelect);
+     virtual PUSEITEM wpFindUseItem(ULONG type, PUSEITEM pCurrentItem);
+     virtual BOOL wpFormatDragItem(PDRAGITEM pdrgItem);
+     virtual BOOL wpFree();
+     virtual BOOL wpFreeMem(PBYTE pByte);
+     virtual BOOL wpHide();
+     virtual void wpInitData();
+     virtual BOOL wpInsertPopupMenuItems(HWND hwndMenu, ULONG iPosition, 
+                                         HMODULE hmod, ULONG MenuID, 
+                                         ULONG SubMenuID);
+     virtual ULONG wpInsertSettingsPage(HWND hwndNotebook, PPAGEINFO ppageinfo);
+     virtual BOOL wpMenuItemHelpSelected(ULONG MenuId);
+     virtual BOOL wpMenuItemSelected(HWND hwndFrame, ULONG ulMenuId);
+     virtual BOOL wpModifyPopupMenu(HWND hwndMenu, HWND hwndCnr, 
+                                    ULONG iPosition);
+     virtual BOOL wpMoveObject(WPFolder* Folder);
+     virtual HWND wpOpen(HWND hwndCnr, ULONG ulView, ULONG param);
+     virtual BOOL wpPrintObject(PPRINTDEST pPrintDest, ULONG ulReserved);
+     virtual ULONG wpQueryConcurrentView();
+     virtual ULONG wpQueryButtonAppearance();
+     virtual ULONG wpQueryConfirmations();
+     virtual BOOL wpQueryDefaultHelp(PULONG pHelpPanelId, PSZ HelpLibrary);
+     virtual ULONG wpQueryDefaultView();
+     virtual ULONG wpQueryDetailsData(PVOID* ppDetailsData, PULONG pcp);
+     virtual ULONG wpQueryError();
+     virtual BOOL wpSetFolder(WPObject* container);
+     virtual WPObject* wpQueryFolder();
+     virtual HPOINTER wpQueryIcon();
+     virtual ULONG wpQueryIconData(PICONINFO pIconInfo);
+     virtual ULONG wpQueryMinWindow();
+     virtual ULONG wpQueryNameClashOptions(ULONG menuID);
+     virtual ULONG wpQueryStyle();
+     virtual BOOL32 wpSetTaskRec(PTASKREC pNew, PTASKREC pOld);
+     virtual PTASKREC wpFindTaskRec();
+     virtual PSZ wpQueryTitle();
+     virtual BOOL wpRegisterView(HWND hwndFrame, PSZ pszViewTitle);
+     virtual ULONG wpReleaseObjectMutexSem();
+     virtual MRESULT wpRender(PDRAGTRANSFER pdxfer);
+     virtual MRESULT wpRenderComplete(PDRAGTRANSFER pdxfer, ULONG ulResult);
+     virtual BOOL32 wpReplaceObject(WPObject* targetObject, BOOL32 fMove);
+     virtual ULONG wpRequestObjectMutexSem(ULONG ulTimeout);
+     virtual BOOL wpRestore();
+     virtual BOOL wpRestoreData(PSZ pszClass, ULONG ulKey, PBYTE pValue, 
+                                PULONG pcbValue);
+     virtual BOOL wpRestoreLong(PSZ pszClass, ULONG ulKey, PULONG pulValue);
+     virtual BOOL wpRestoreState(ULONG ulReserved);
+     virtual BOOL wpRestoreString(PSZ pszClass, ULONG ulKey, 
+                                  PSZ pszValue, PULONG pcbValue);
+     virtual BOOL wpSaveData(PSZ pszClass, ULONG ulKey, PBYTE pValue, 
+                             ULONG cbValue);
+     virtual BOOL wpSaveImmediate();
+     virtual BOOL wpSaveDeferred();
+     virtual BOOL wpSaveLong(PSZ pszClass, ULONG ulKey, ULONG ulValue);
+     virtual BOOL wpSaveState();
+     virtual BOOL wpSaveString(PSZ pszClass, ULONG ulKey, PSZ pszValue);
+     virtual BOOL wpScanSetupString(PSZ pszSetupString, PSZ pszKey, 
+                                    PSZ pszValue, PULONG pcbValue);
+     virtual void wpSetConcurrentView(ULONG ulCCView);
+     virtual void wpSetButtonAppearance(ULONG ulButtonType);
+     virtual BOOL wpSetDefaultHelp(ULONG HelpPanelId, PSZ HelpLibrary);
+     virtual BOOL wpSetDefaultView(ULONG ulView);
+     virtual BOOL wpSetError(ULONG ulErrorId);
+     virtual BOOL wpSetIconHandle(HPOINTER hptrNewIcon);
+     virtual USHORT wpQueryScreenGroupID(USHORT usPrevSgId);
+     virtual BOOL wpSetupOnce(PSZ pszSetupString);
+     virtual BOOL wpSetIcon(HPOINTER hptrNewIcon);
+     virtual BOOL wpSetIconData(PICONINFO pIconInfo);
+     virtual void wpSetMinWindow(ULONG ulMinWindow);
+     virtual BOOL wpSetStyle(ULONG ulNewStyle);
+     virtual BOOL wpModifyStyle(ULONG ulStyleFlags, ULONG ulStyleMask);
+     virtual BOOL wpSetTitle(PSZ pszNewTitle);
+     virtual BOOL wpSetup(PSZ pszSetupString);
+     virtual BOOL wpSwitchTo(ULONG View);
+     virtual void wpUnInitData();
+     virtual HWND wpViewObject(HWND hwndCnr, ULONG ulView, ULONG param);
+     virtual ULONG wpQueryTrueStyle();
+     virtual HOBJECT wpQueryHandle();
+     virtual BOOL wpUnlockObject();
+     virtual void wpObjectReady(ULONG ulCode, WPObject* refObject);
+     virtual BOOL wpIsObjectInitialized();
+     virtual WPObject* wpCreateShadowObjectExt(WPFolder* Folder, 
+                                               BOOL fLock, PSZ pszSetup, 
+                                               M_WPObject* shadowClass);
+     virtual BOOL wpCnrDeleteUseItem(HWND hwndCnr);
+     virtual BOOL wpIsDeleteable();
+     virtual PMINIRECORDCORE wpQueryCoreRecord();
+     virtual BOOL wpSetObjectID(PSZ pszObjectID);
+     virtual PSZ wpQueryObjectID();
+     virtual BOOL wpSetDefaultIconPos(PPOINTL pPointl);
+     virtual BOOL wpQueryDefaultIconPos(PPOINTL pPointl);
+     virtual void wpCnrRefreshDetails();
+     virtual PVIEWITEM wpFindViewItem(ULONG flViews, PVIEWITEM pCurrentItem);
+     virtual void wpLockObject();
+     virtual BOOL wpIsLocked();
+     virtual PULONG wpQueryContainerFlagPtr();
+     virtual ULONG wpWaitForClose(LHANDLE lhView, ULONG ulViews, 
+                                  long lTimeOut, BOOL bAutoClose);
+     WPObject();  
+     virtual ~WPObject();  
+     #pragma SOMReleaseOrder ( \
+			      "wpSetTitle", \
+			      "wpQueryTitle", \
+			      "wpSetStyle", \
+			      "wpQueryStyle", \
+			      "wpSetIcon", \
+			      "wpQueryIcon", \
+			      "wpSetFolder", \
+			      "wpQueryFolder", \
+			      *, \
+			      *, \
+			      "wpSetDefaultView", \
+			      "wpQueryDefaultView", \
+			      *, \
+			      "wpSaveState", \
+			      *, \
+			      *, \
+			      "wpSaveLong", \
+			      "wpSaveString", \
+			      "wpSaveData", \
+			      *, \
+			      "wpRestoreState", \
+			      *, \
+			      *, \
+			      "wpRestoreLong", \
+			      "wpRestoreString", \
+			      "wpRestoreData", \
+			      *, \
+			      "wpAllocMem", \
+			      "wpFreeMem", \
+			      "wpAddToObjUseList", \
+			      "wpDeleteFromObjUseList", \
+			      "wpFindUseItem", \
+			      "wpSwitchTo", \
+			      *, \
+			      "wpFilterPopupMenu", \
+			      "wpModifyPopupMenu", \
+			      "wpMenuItemSelected", \
+			      "wpFormatDragItem", \
+			      "wpDrop", \
+			      "wpDragOver", \
+			      "wpRender", \
+			      "wpEndConversation", \
+			      *, \
+			      *, \
+			      *, \
+			      "wpFree", \
+			      "wpCopiedFromTemplate", \
+			      "wpAddSettingsPages", \
+			      "wpAddObjectGeneralPage", \
+			      "wpDisplayHelp", \
+			      "wpMenuItemHelpSelected", \
+			      "wpInsertSettingsPage", \
+			      "wpInsertPopupMenuItems", \
+			      *, \
+			      *, \
+			      *, \
+			      *, \
+			      "wpCnrInsertObject", \
+			      "wpCnrRemoveObject", \
+			      "wpInitData", \
+			      "wpUnInitData", \
+			      "wpSetup", \
+			      "wpScanSetupString", \
+			      "wpSaveImmediate", \
+			      "wpOpen", \
+			      "wpClose", \
+			      "wpHide", \
+			      "wpRestore", \
+			      "wpSetIconData", \
+			      "wpQueryIconData", \
+			      *, \
+			      "wpDelete", \
+			      "wpConfirmDelete", \
+			      *, \
+			      *, \
+			      *, \
+			      "wpRegisterView", \
+			      *, \
+			      "wpSetDefaultHelp", \
+			      "wpQueryDefaultHelp", \
+			      "wpDoesObjectMatch", \
+			      "wpCnrRefreshDetails", \
+			      "wpSetError", \
+			      "wpQueryError", \
+			      "wpDraggedOverObject", \
+			      "wpDroppedOnObject", \
+			      "wpSetDefaultIconPos", \
+			      "wpQueryDefaultIconPos", \
+			      *, \
+			      *, \
+			      "wpSetObjectID", \
+			      "wpQueryObjectID", \
+			      "wpIsDeleteable", \
+			      "wpQueryHandle", \
+			      "wpSaveDeferred", \
+			      "wpAddObjectWindowPage", \
+			      "wpQueryConcurrentView", \
+			      "wpSetConcurrentView", \
+			      "wpQueryMinWindow", \
+			      "wpSetMinWindow", \
+			      "wpViewObject", \
+			      "wpQueryButtonAppearance", \
+			      "wpSetButtonAppearance", \
+			      "wpQueryConfirmations", \
+			      "wpCnrSetEmphasis", \
+			      "wpQueryCoreRecord", \
+			      "wpFindViewItem", \
+			      "wpCreateFromTemplate", \
+			      "wpQueryTrueStyle", \
+			      "wpAssertObjectMutexSem", \
+			      "wpReleaseObjectMutexSem", \
+			      "wpRequestObjectMutexSem", \
+			      "wpCreateAnother", \
+			      "wpCreateShadowObject", \
+			      "wpCopyObject", \
+			      "wpMoveObject", \
+			      "wpLockObject", \
+			      "wpUnlockObject", \
+			      "wpIsLocked", \
+			      "wpRenderComplete", \
+			      "wpQueryDetailsData", \
+			      "wpPrintObject", \
+			      *, \
+			      "wpSetTaskRec", \
+			      *, \
+			      "wpModifyStyle", \
+			      *, \
+			      "wpFindTaskRec", \
+			      "wpAppendObject", \
+			      "wpReplaceObject", \
+			      "wpQueryNameClashOptions", \
+			      "wpConfirmObjectTitle", \
+			      *, \
+			      "wpQueryContainerFlagPtr", \
+			      *, \
+			      *, \
+			      *, \
+			      "wpCnrDeleteUseItem", \
+			      "wpObjectReady", \
+			      "wpIsObjectInitialized", \
+			      "wpCreateShadowObjectExt", \
+			      "wpSetIconHandle", \
+			      *, \
+			      *, \
+			      "wpDisplayMenu", \
+			      "wpWaitForClose", \
+			      "wpQueryScreenGroupID", \
+			      "wpSetupOnce", \
+			      "wpAddObjectGeneralPage2", \
+			      *, \
+			      *)
+};
+#pragma SOMAsDefault(pop)
+
+     #pragma SOMNonDTS(pop)
+/* End WPObject */
+
+
+
+
+/* Start Class M_WPObject */
+
+#include <somcls.hh>
+#pragma SOMNonDTS(on)
+
+#pragma SOMAsDefault(on)
+
+
+/************ From WPObject.h ************/
+
+
+
+/*
+ * External name shortening if required
+ */
+#ifdef SOM_USE_SHORT_EXTERNAL_NAMES
+#define M_WPObjectNewClass wpobjc
+//#pragma linkage(wpobjc, system)
+#define M_WPObjectClassData wpobjd
+#define M_WPObjectCClassData wpobjx
+#endif /* SOM_USE_SHORT_EXTERNAL_NAMES */
+
+/*--------------Migration------------*/
+#define M_WPObject_classObj M_WPObjectClassData.classObject
+#define _M_WPObject M_WPObject_classObj
+
+
+/*
+ * Declare the class data structure
+ */
+SOMEXTERN struct M_WPObjectClassDataStructure {
+	SOMClass *classObject;
+	somMToken wpclsInitData;
+	somMToken wpclsUnInitData;
+	somMToken withdrawn8;
+	somMToken wpclsMakeAwake;
+	somMToken wpclsIncUsage;
+	somMToken wpclsDecUsage;
+	somMToken wpclsQueryTitle;
+	somMToken wpclsQueryIcon;
+	somMToken wpclsQueryDefaultHelp;
+	somMToken wpclsQueryStyle;
+	somMToken wpclsQueryDetailsInfo;
+	somMToken wpclsQueryDefaultView;
+	somMToken wpclsQueryDetails;
+	somMToken wpclsQuerySearchInfo;
+	somMToken wpclsQueryExtendedCriteria;
+	somMToken wpclsCreateDefaultTemplates;
+	somMToken withdrawn9;
+	somMToken wpclsFindObjectFirst;
+	somMToken wpclsFindObjectNext;
+	somMToken wpclsFindObjectEnd;
+	somMToken wpclsFindObjects;
+	somMToken wpclsSetError;
+	somMToken wpclsQueryError;
+	somMToken wpclsQuerySettingsPageSize;
+	somMToken wpclsSetSettingsPageSize;
+	somMToken wpclsQueryIconData;
+	somMToken wpclsSetIcon;
+	somMToken wpclsSetIconData;
+	somMToken wpclsQueryObject;
+	somMToken wpclsObjectFromHandle;
+	somMToken wpclsSaveDirtyObjects;
+	somMToken wpclsLockDirtyList;
+	somMToken wpclsUnlockDirtyList;
+	somMToken wpclsLockRestartList;
+	somMToken wpclsUnlockRestartList;
+	somMToken wpclsQueryButtonAppearance;
+	somMToken wpclsNew;
+	somMToken wpclsQueryFolder;
+	somMToken wpclsLockSleepyList;
+	somMToken wpclsUnlockSleepyList;
+	somMToken wpclsRemoveObjects;
+	somMToken wpclsInsertMultipleObjects;
+	somMToken wpclsINew;
+	somMToken wpclsFindOneObject;
+	somMToken wpclsQueryMaxAnimationIcons;
+
+}  SOMDLINK  M_WPObjectClassData;
+
+/*
+ * Declare the C specific class data structure
+ */
+SOMEXTERN struct M_WPObjectCClassDataStructure {
+	somMethodTabs parentMtab;
+	somDToken instanceDataToken;
+} SOMDLINK M_WPObjectCClassData;
+
+
+
+
+/*
+ * New and Renew macros for M_WPObject
+ */
+#define M_WPObjectNew() \
+   (_somNew(_M_WPObject ? _M_WPObject : M_WPObjectNewClass(M_WPObject_MajorVersion, M_WPObject_MinorVersion)))
+#define M_WPObjectRenew(buf) \
+   (_somRenew(_M_WPObject ? _M_WPObject : M_WPObjectNewClass(M_WPObject_MajorVersion, M_WPObject_MinorVersion), buf))
+
+/*
+ * Override method: somUninit
+ */
+#define M_WPObject_somUninit(somSelf) \
+	SOMObject_somUninit(somSelf)
+
+/*
+ * Override method: somClassReady
+ */
+#define M_WPObject_somClassReady(somSelf) \
+	SOMClass_somClassReady(somSelf)
+
+/*
+ * Override method: somNew
+ */
+#define M_WPObject_somNew(somSelf) \
+	SOMClass_somNew(somSelf)
+
+/*
+ * Override method: somRenew
+ */
+#define M_WPObject_somRenew(somSelf,obj) \
+	SOMClass_somRenew(somSelf,obj)
+
+
+
+/*
+ * New Method: wpclsObjectFromHandle
+ */
+typedef WPObject*   SOMLINK somTP_M_WPObject_wpclsObjectFromHandle(M_WPObject *somSelf,
+		HOBJECT hObject);
+//#pragma linkage(somTP_M_WPObject_wpclsObjectFromHandle, system)
+typedef somTP_M_WPObject_wpclsObjectFromHandle *somTD_M_WPObject_wpclsObjectFromHandle;
+#define somMD_M_WPObject_wpclsObjectFromHandle "::M_WPObject::wpclsObjectFromHandle"
+#define M_WPObject_wpclsObjectFromHandle(somSelf,hObject) \
+    (SOM_Resolve(somSelf, M_WPObject, wpclsObjectFromHandle) \
+	(somSelf,hObject))
+#ifndef SOMGD_wpclsObjectFromHandle
+    #if (defined(_wpclsObjectFromHandle) || defined(__wpclsObjectFromHandle))
+        #undef _wpclsObjectFromHandle
+        #undef __wpclsObjectFromHandle
+        #define SOMGD_wpclsObjectFromHandle 1
+    #else
+        #define _wpclsObjectFromHandle M_WPObject_wpclsObjectFromHandle
+    #endif /* _wpclsObjectFromHandle */
+#endif /* SOMGD_wpclsObjectFromHandle */
+
+
+/*
+ * New Method: wpclsNew
+ */
+typedef WPObject*   SOMLINK somTP_M_WPObject_wpclsNew(M_WPObject *somSelf,
+		PSZ pszTitle,
+		PSZ pszSetupEnv,
+		WPFolder* Folder,
+		BOOL fLock);
+//#pragma linkage(somTP_M_WPObject_wpclsNew, system)
+typedef somTP_M_WPObject_wpclsNew *somTD_M_WPObject_wpclsNew;
+#define somMD_M_WPObject_wpclsNew "::M_WPObject::wpclsNew"
+#define M_WPObject_wpclsNew(somSelf,pszTitle,pszSetupEnv,Folder,fLock) \
+    (SOM_Resolve(somSelf, M_WPObject, wpclsNew) \
+	(somSelf,pszTitle,pszSetupEnv,Folder,fLock))
+#ifndef SOMGD_wpclsNew
+    #if (defined(_wpclsNew) || defined(__wpclsNew))
+        #undef _wpclsNew
+        #undef __wpclsNew
+        #define SOMGD_wpclsNew 1
+    #else
+        #define _wpclsNew M_WPObject_wpclsNew
+    #endif /* _wpclsNew */
+#endif /* SOMGD_wpclsNew */
+
+
+/*
+ * New Method: wpclsInitData
+ */
+typedef void   SOMLINK somTP_M_WPObject_wpclsInitData(M_WPObject *somSelf);
+//#pragma linkage(somTP_M_WPObject_wpclsInitData, system)
+typedef somTP_M_WPObject_wpclsInitData *somTD_M_WPObject_wpclsInitData;
+#define somMD_M_WPObject_wpclsInitData "::M_WPObject::wpclsInitData"
+#define M_WPObject_wpclsInitData(somSelf) \
+    (SOM_Resolve(somSelf, M_WPObject, wpclsInitData) \
+	(somSelf))
+#ifndef SOMGD_wpclsInitData
+    #if (defined(_wpclsInitData) || defined(__wpclsInitData))
+        #undef _wpclsInitData
+        #undef __wpclsInitData
+        #define SOMGD_wpclsInitData 1
+    #else
+        #define _wpclsInitData M_WPObject_wpclsInitData
+    #endif /* _wpclsInitData */
+#endif /* SOMGD_wpclsInitData */
+
+/*
+ * New Method: wpclsQueryStyle
+ */
+typedef ULONG   SOMLINK somTP_M_WPObject_wpclsQueryStyle(M_WPObject *somSelf);
+//#pragma linkage(somTP_M_WPObject_wpclsQueryStyle, system)
+typedef somTP_M_WPObject_wpclsQueryStyle *somTD_M_WPObject_wpclsQueryStyle;
+#define somMD_M_WPObject_wpclsQueryStyle "::M_WPObject::wpclsQueryStyle"
+#define M_WPObject_wpclsQueryStyle(somSelf) \
+    (SOM_Resolve(somSelf, M_WPObject, wpclsQueryStyle) \
+	(somSelf))
+#ifndef SOMGD_wpclsQueryStyle
+    #if (defined(_wpclsQueryStyle) || defined(__wpclsQueryStyle))
+        #undef _wpclsQueryStyle
+        #undef __wpclsQueryStyle
+        #define SOMGD_wpclsQueryStyle 1
+    #else
+        #define _wpclsQueryStyle M_WPObject_wpclsQueryStyle
+    #endif /* _wpclsQueryStyle */
+#endif /* SOMGD_wpclsQueryStyle */
+
+/*
+ * New Method: wpclsQueryObject
+ */
+typedef WPObject*   SOMLINK somTP_M_WPObject_wpclsQueryObject(M_WPObject *somSelf, 
+		HOBJECT hObject);
+//#pragma linkage(somTP_M_WPObject_wpclsQueryObject, system)
+typedef somTP_M_WPObject_wpclsQueryObject *somTD_M_WPObject_wpclsQueryObject;
+#define somMD_M_WPObject_wpclsQueryObject "::M_WPObject::wpclsQueryObject"
+#define M_WPObject_wpclsQueryObject(somSelf,hObject) \
+    (SOM_Resolve(somSelf, M_WPObject, wpclsQueryObject) \
+	(somSelf,hObject))
+#ifndef SOMGD_wpclsQueryObject
+    #if (defined(_wpclsQueryObject) || defined(__wpclsQueryObject))
+        #undef _wpclsQueryObject
+        #undef __wpclsQueryObject
+        #define SOMGD_wpclsQueryObject 1
+    #else
+        #define _wpclsQueryObject M_WPObject_wpclsQueryObject
+    #endif /* _wpclsQueryObject */
+#endif /* SOMGD_wpclsQueryObject */
+
+
+/*
+ * New Method: wpclsQueryDetails
+ */
+typedef PCLASSDETAILS   SOMLINK somTP_M_WPObject_wpclsQueryDetails(M_WPObject *somSelf);
+//#pragma linkage(somTP_M_WPObject_wpclsQueryDetails, system)
+typedef somTP_M_WPObject_wpclsQueryDetails *somTD_M_WPObject_wpclsQueryDetails;
+#define somMD_M_WPObject_wpclsQueryDetails "::M_WPObject::wpclsQueryDetails"
+#define M_WPObject_wpclsQueryDetails(somSelf) \
+    (SOM_Resolve(somSelf, M_WPObject, wpclsQueryDetails) \
+	(somSelf))
+#ifndef SOMGD_wpclsQueryDetails
+    #if (defined(_wpclsQueryDetails) || defined(__wpclsQueryDetails))
+        #undef _wpclsQueryDetails
+        #undef __wpclsQueryDetails
+        #define SOMGD_wpclsQueryDetails 1
+    #else
+        #define _wpclsQueryDetails M_WPObject_wpclsQueryDetails
+    #endif /* _wpclsQueryDetails */
+#endif /* SOMGD_wpclsQueryDetails */
+
+/*
+ * New Method: wpclsQueryDetailsInfo
+ */
+typedef ULONG   SOMLINK somTP_M_WPObject_wpclsQueryDetailsInfo(M_WPObject *somSelf,
+		PCLASSFIELDINFO* ppClassFieldInfo,
+		PULONG pSize);
+//#pragma linkage(somTP_M_WPObject_wpclsQueryDetailsInfo, system)
+typedef somTP_M_WPObject_wpclsQueryDetailsInfo *somTD_M_WPObject_wpclsQueryDetailsInfo;
+#define somMD_M_WPObject_wpclsQueryDetailsInfo "::M_WPObject::wpclsQueryDetailsInfo"
+#define M_WPObject_wpclsQueryDetailsInfo(somSelf,ppClassFieldInfo,pSize) \
+    (SOM_Resolve(somSelf, M_WPObject, wpclsQueryDetailsInfo) \
+	(somSelf,ppClassFieldInfo,pSize))
+#ifndef SOMGD_wpclsQueryDetailsInfo
+    #if (defined(_wpclsQueryDetailsInfo) || defined(__wpclsQueryDetailsInfo))
+        #undef _wpclsQueryDetailsInfo
+        #undef __wpclsQueryDetailsInfo
+        #define SOMGD_wpclsQueryDetailsInfo 1
+    #else
+        #define _wpclsQueryDetailsInfo M_WPObject_wpclsQueryDetailsInfo
+    #endif /* _wpclsQueryDetailsInfo */
+#endif /* SOMGD_wpclsQueryDetailsInfo */
+
+
+
+
+
+class M_WPObject : public SOMClass {
+
+	#pragma SOMClassName(*, "M_WPObject")
+	#pragma SOMNoMangling(*)
+	#pragma SOMNonDTS(*)
+
+     #pragma SOMClassVersion (M_WPObject, 1, 2)
+     #pragma SOMCallstyle (oidl)
+     #pragma SOMAsDefault(off)
+     #pragma SOMAsDefault(pop)
+  public :
+     virtual BOOL wpclsCreateDefaultTemplates(WPObject* Folder);
+     virtual void wpclsInitData();
+     virtual WPObject* wpclsMakeAwake(PSZ pszTitle, ULONG ulStyle, 
+                                      HPOINTER hptrIcon, POBJDATA pObjData, 
+                                      WPFolder* Folder, ULONG ulUser);
+     virtual WPObject* wpclsNew(PSZ pszTitle, PSZ pszSetupEnv, 
+                                WPFolder* Folder, BOOL fLock);
+     virtual BOOL wpclsQueryDefaultHelp(PULONG pHelpPanelId, 
+                                        PSZ pszHelpLibrary);
+     virtual ULONG wpclsQueryDefaultView();
+     virtual PCLASSDETAILS wpclsQueryDetails();
+     virtual ULONG wpclsQueryDetailsInfo(PCLASSFIELDINFO* ppClassFieldInfo, 
+                                         PULONG pSize);
+     virtual BOOL wpclsQueryExtendedCriteria(PSZ pszName, ULONG ulSearchType, 
+                                             PVOID pvoidExtendedCriteria);
+     virtual WPObject* wpclsQueryFolder(PSZ pszLocation, BOOL fLock);
+     virtual HPOINTER wpclsQueryIcon();
+     virtual void wpclsQuerySearchInfo(M_WPObject** ClassExtended, 
+                                       M_WPObject** ClassCreate, 
+                                       PULONG pulClassCriteriaSize);
+     virtual ULONG wpclsQueryStyle();
+     virtual PSZ wpclsQueryTitle();
+     virtual void wpclsUnInitData();
+     virtual BOOL wpclsFindObjectFirst(PCLASS pClassList, PHFIND phFind, 
+                                       PSZ pszTitle, WPFolder* Folder, 
+                                       BOOL fSubfolders, PVOID pExtendedCriteria, 
+                                       POBJECT pBuffer, PULONG pCount);
+     virtual BOOL wpclsFindObjectNext(HFIND hFind, POBJECT pBuffer, 
+                                      PULONG pCount);
+     virtual BOOL wpclsFindObjectEnd(HFIND hFind);
+     virtual BOOL wpclsSetError(ULONG ulErrorId);
+     virtual ULONG wpclsQueryError();
+     virtual BOOL wpclsQuerySettingsPageSize(PSIZEL pSizl);
+     virtual ULONG wpclsQueryIconData(PICONINFO pIconInfo);
+     virtual WPObject* wpclsQueryObject(HOBJECT hObject);
+     virtual ULONG wpclsQueryButtonAppearance();
+     virtual void wpclsDecUsage();
+     virtual void wpclsIncUsage();
+     virtual BOOL wpclsInsertMultipleObjects(HWND hwndCnr, PPOINTL pptlIcon, 
+                                             PVOID* pObjectArray, 
+                                             PVOID pRecordParent, 
+                                             ULONG NumRecords);
+     virtual WPObject* wpclsFindOneObject(HWND hwndOwner, PSZ pszFindParams);
+     virtual BOOL wpclsSetSettingsPageSize(PSIZEL pSizl);
+     virtual BOOL wpclsSetIconData(PICONINFO pIconInfo);
+     virtual BOOL wpclsSetIcon(HPOINTER hptrNewIcon);
+     virtual WPObject* wpclsObjectFromHandle(HOBJECT hObject);
+     virtual BOOL wpclsRemoveObjects(HWND hwndCnr, PVOID* pRecordArray, 
+                                     ULONG NumRecords, BOOL RemoveAll);
+     virtual ~M_WPObject();  
+     virtual void somClassReady();
+     virtual SOMObject* somNew();
+     virtual SOMObject* somRenew(void* obj);
+     #pragma SOMReleaseOrder ( \
+			      "wpclsInitData", \
+			      "wpclsUnInitData", \
+			      *, \
+			      "wpclsMakeAwake", \
+			      "wpclsIncUsage", \
+			      "wpclsDecUsage", \
+			      "wpclsQueryTitle", \
+			      "wpclsQueryIcon", \
+			      "wpclsQueryDefaultHelp", \
+			      "wpclsQueryStyle", \
+			      "wpclsQueryDetailsInfo", \
+			      "wpclsQueryDefaultView", \
+			      "wpclsQueryDetails", \
+			      "wpclsQuerySearchInfo", \
+			      "wpclsQueryExtendedCriteria", \
+			      "wpclsCreateDefaultTemplates", \
+			      *, \
+			      "wpclsFindObjectFirst", \
+			      "wpclsFindObjectNext", \
+			      "wpclsFindObjectEnd", \
+			      *, \
+			      "wpclsSetError", \
+			      "wpclsQueryError", \
+			      "wpclsQuerySettingsPageSize", \
+			      "wpclsSetSettingsPageSize", \
+			      "wpclsQueryIconData", \
+			      "wpclsSetIcon", \
+			      "wpclsSetIconData", \
+			      "wpclsQueryObject", \
+			      "wpclsObjectFromHandle", \
+			      *, \
+			      *, \
+			      *, \
+			      *, \
+			      *, \
+			      "wpclsQueryButtonAppearance", \
+			      "wpclsNew", \
+			      "wpclsQueryFolder", \
+			      *, \
+			      *, \
+			      "wpclsRemoveObjects", \
+			      "wpclsInsertMultipleObjects", \
+			      *, \
+			      "wpclsFindOneObject", \
+			      *)
+};
+     #pragma SOMMetaClass (WPObject, "M_WPObject")
+
+#pragma SOMAsDefault(pop)
+
+     #pragma SOMNonDTS(pop)
+/* End M_WPObject */
+#endif /* _DTS_HH_INCLUDED_wpobject */
+
