Jump to content

WinLoadFileIcon

From EDM2
Revision as of 14:47, 16 May 2023 by Ak120 (talk | contribs)

This function returns a pointer to an icon which is associated with the file specified by pszFileName.

Syntax

WinLoadFileIcon(pszFileName, fPrivate)

Parameters

pszFileName (PSZ) - input
Pointer to file name.
A pointer to a zero-terminated string which contains the name of the file whose icon will be loaded.
fPrivate (BOOL) - input
Icon usage flag.
TRUE
A private copy of this icon is requested. This flag should be used if the application needs to modify the icon.
FALSE
A shared pointer to this icon is requested. This flag should be used if application needs to display the icon without modifying it. This should be used whenever possible to optimize system resource use.

Returns

hIcon (HPOINTER) - returns
Icon handle.
NULL
Error occurred.
OTHER
Handle to an icon.

Remarks

The icon will be retrieved in the following order until an icon has been found:

  • ICON extended attribute
  • ICO file in same directory with same prefix
  • Application specific icon (if PM executable or MS Windows* executable)
  • PM application icon (if PM executable)
  • MS Windows* application icon (if MS Windows* application executable)
  • OS/2 application icon (if OS/2 full-screen only executable )
  • OS/2 window icon (if OS/2 window compatible executable)
  • DOS windowed application icon (if DOS windowed executable)
  • Program application (if unknown type executable)
  • Data icon specified by associated application
  • Data icon of associated application
  • Data file icon (if not program or directory)
  • Directory icon (if directory)

The HPOINTER returned in fPrivate should be freed by the caller via WinFreeFileIcon when it is no longer being used.

Example Code

Definition

#define INCL_WINWORKPLACE
#include <os2.h>

PSZ         pszFileName;  /*  Pointer to file name. */
BOOL        fPrivate;     /*  Icon usage flag. */
HPOINTER    hIcon;        /*  Icon handle. */

hIcon = WinLoadFileIcon(pszFileName, fPrivate);

Related Functions