L17: Find ID of resource from one-based index. i.e. IconNumber -> resource ID. v1.1.22.05: Return LPTSTR since some (very few) icons have a string ID.
| 2541 | // L17: Find ID of resource from one-based index. i.e. IconNumber -> resource ID. |
| 2542 | // v1.1.22.05: Return LPTSTR since some (very few) icons have a string ID. |
| 2543 | LPTSTR ResourceIndexToId(HMODULE aModule, LPCTSTR aType, int aIndex) |
| 2544 | { |
| 2545 | ResourceIndexToIdEnumData enum_data; |
| 2546 | enum_data.find_index = aIndex; |
| 2547 | enum_data.index = 0; |
| 2548 | // NULL can't be used to indicate "not found", as any value between 0 and 0xFFFF is an |
| 2549 | // integer ID, including zero, even though some compilers replace it with "0" (string). |
| 2550 | // (LPTSTR)-1 or "" could be used instead, but this method should be safest, since we |
| 2551 | // know the API cannot ever return a string at this address: |
| 2552 | enum_data.result = RESOURCE_ID_NOT_FOUND; |
| 2553 | |
| 2554 | EnumResourceNames(aModule, aType, &ResourceIndexToIdEnumProc, (LONG_PTR)&enum_data); |
| 2555 | |
| 2556 | return enum_data.result; |
| 2557 | } |
| 2558 | |
| 2559 | // L17: Extract icon of the appropriate size from an executable (or compatible) file. |
| 2560 | HICON ExtractIconFromExecutable(LPTSTR aFilespec, int aIconNumber, int aWidth, int aHeight, HMODULE *apModule) |
no outgoing calls
no test coverage detected