The following sample code fragment shows how to obtain the icon associated with the TUTORIAL.EXE file and shows how to display it as the user's tutorial application:

#define  INCL_WINWORKPLACE
#include "os2.h"

PSZ pszFileName = "tutorial.exe";
PSZ pszMyTutorial = "mytutor.exe";

HPOINTER hptr;
ULONG    rc;

{
  hptr = WinLoadFileIcon(pszFileName, FALSE);
  if (hptr != NULL)
  {
    /* Obtain the icon associated with TUTORIAL.EXE for displaying purpose only */
    rc = WinSetFileIcon(pszMyTutorial, hptr);
    if (rc != NULL)
    {
      /* MYTUTOR.EXE now has the icon associated with TUTORIAL.EXE */
    }
    else
    {
      /* WinSetFileIcon failed */
    }
  }
  else
  {
     /* WinLoadFileIcon failed */
  }

   .
   .
   .
  /* Later free the file icon associated with the TUTORIAL.EXE file */
  rc = WinFreeFileIcon(hptr);
  if (rc != NULL)
  {
    /* Icon pointer freed */
  }
  else
  {
    /* WinFreeFileIcon failed */
  }
}


[Back] [Next]