WinLoadFileIcon: Difference between revisions
Appearance
Created page with "This function returns a pointer to an icon which is associated with the file specified by pszFileName. ==Syntax== WinLoadFileIcon(pszFileName, fPrivate) ==Parameters== ; ..." |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
This function returns a pointer to an icon which is associated with the file specified by pszFileName. | This function returns a pointer to an icon which is associated with the file specified by pszFileName. | ||
==Syntax== | ==Syntax== | ||
Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
; pszFileName ([[PSZ]]) - input:Pointer to file name. | |||
; pszFileName (PSZ) - input | :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. | |||
:Pointer to file name. | :;TRUE:A private copy of this icon is requested. This flag should be used if the application needs to modify the icon. | ||
:A pointer to a zero-terminated string which contains the name of the file whose icon will be loaded. | :;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. | ||
;fPrivate (BOOL) - input | |||
:Icon usage flag. | |||
:;TRUE | |||
:;FALSE | |||
==Returns== | ==Returns== | ||
; hIcon (HPOINTER) - returns | ; hIcon ([[HPOINTER]]) - returns:Icon handle. | ||
:Icon handle. | :;NULL:Error occurred. | ||
:;NULL | :;OTHER:Handle to an icon. | ||
:;OTHER | |||
==Remarks== | ==Remarks== | ||
Line 42: | Line 30: | ||
* Data icon of associated application | * Data icon of associated application | ||
* Data file icon (if not program or directory) | * Data file icon (if not program or directory) | ||
* Directory icon (if 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. | The HPOINTER returned in fPrivate should be freed by the caller via WinFreeFileIcon when it is no longer being used. | ||
==Example Code== | ==Example Code== | ||
Line 61: | Line 49: | ||
* [[WinSetFileIcon]] | * [[WinSetFileIcon]] | ||
* [[WinFreeFileIcon]] | * [[WinFreeFileIcon]] | ||
[[Category:Win]] | [[Category:Win]] |
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);