Mercurial > dwindows
comparison os2/dw.c @ 257:9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
to be filled in shortly.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 20 Feb 2003 20:19:09 +0000 |
parents | 00d2b1bcf036 |
children | bf8b907f8a29 |
comparison
equal
deleted
inserted
replaced
256:63d68387d924 | 257:9ea4ac9a097f |
---|---|
5811 { | 5811 { |
5812 return WinLoadPointer(HWND_DESKTOP,module,id); | 5812 return WinLoadPointer(HWND_DESKTOP,module,id); |
5813 } | 5813 } |
5814 | 5814 |
5815 /* | 5815 /* |
5816 * Obtains an icon from a file. | |
5817 * Parameters: | |
5818 * filename: Name of the file, omit extention to have | |
5819 * DW pick the appropriate file extension. | |
5820 * (ICO on OS/2 or Windows, XPM on Unix) | |
5821 */ | |
5822 unsigned long API dw_icon_load_from_file(char *filename) | |
5823 { | |
5824 char *file = alloca(strlen(filename) + 5); | |
5825 | |
5826 if(!file) | |
5827 return 0; | |
5828 | |
5829 strcpy(file, filename); | |
5830 | |
5831 /* check if we can read from this file (it exists and read permission) */ | |
5832 if(access(file, 04) != 0) | |
5833 { | |
5834 /* Try with .bmp extention */ | |
5835 strcat(file, ".ico"); | |
5836 if(access(file, 04) != 0) | |
5837 return 0; | |
5838 } | |
5839 return WinLoadFileIcon(file, FALSE); | |
5840 } | |
5841 | |
5842 /* | |
5816 * Frees a loaded resource in OS/2 and Windows. | 5843 * Frees a loaded resource in OS/2 and Windows. |
5817 * Parameters: | 5844 * Parameters: |
5818 * handle: Handle to icon returned by dw_icon_load(). | 5845 * handle: Handle to icon returned by dw_icon_load(). |
5819 */ | 5846 */ |
5820 void API dw_icon_free(unsigned long handle) | 5847 void API dw_icon_free(unsigned long handle) |