WinLoadFileIcon: Difference between revisions
Appearance
mNo edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
; pszFileName (PSZ) - input:Pointer to file name. | ; 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. | :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. | ;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. | :;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. | :;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== | ==Returns== | ||
; hIcon (HPOINTER) - returns:Icon handle. | ; hIcon ([[HPOINTER]]) - returns:Icon handle. | ||
:;NULL:Error occurred. | :;NULL:Error occurred. | ||
:;OTHER:Handle to an icon. | :;OTHER:Handle to an icon. |
Latest revision as of 14:19, 8 April 2024
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);