-
Bug
-
Resolution: Unresolved
-
P4
-
17, 18, 19, 20
-
windows
The documentation for IExtractIconW::Extract [1] mentions the method may return S_FALSE in which case the icon extraction should be performed by the application.
This case is not handled in Java_sun_awt_shell_Win32ShellFolder2_extractIcon [2].
The suggestion in the article [3] is to use SHDefExtractIcon [4]:
HICON hico;
if (SHDefExtractIcon(TEXT("C:\\Windows\\Explorer.exe"),
1, 0, &hico, NULL, 48) == S_OK) {
DrawIconEx(pps->hdc, 0, 0, hico, 0, 0, 0, NULL, DI_NORMAL);
DestroyIcon(hico);
}
References:
[1] https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-iextracticonw-extract
[2] https://github.com/openjdk/jdk/blob/94127f43a4a28a89094fa93cd1da49763134f9db/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp#L986
[3] https://devblogs.microsoft.com/oldnewthing/20140501-00/?p=1103
[4] https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shdefextracticonw
The issue was raised in the code review forJDK-8282526:
[5] https://github.com/openjdk/jdk/pull/7805#discussion_r893306463
[6] https://github.com/openjdk/jdk/pull/7805#discussion_r893275672
This case is not handled in Java_sun_awt_shell_Win32ShellFolder2_extractIcon [2].
The suggestion in the article [3] is to use SHDefExtractIcon [4]:
HICON hico;
if (SHDefExtractIcon(TEXT("C:\\Windows\\Explorer.exe"),
1, 0, &hico, NULL, 48) == S_OK) {
DrawIconEx(pps->hdc, 0, 0, hico, 0, 0, 0, NULL, DI_NORMAL);
DestroyIcon(hico);
}
References:
[1] https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-iextracticonw-extract
[2] https://github.com/openjdk/jdk/blob/94127f43a4a28a89094fa93cd1da49763134f9db/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp#L986
[3] https://devblogs.microsoft.com/oldnewthing/20140501-00/?p=1103
[4] https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shdefextracticonw
The issue was raised in the code review for
[5] https://github.com/openjdk/jdk/pull/7805#discussion_r893306463
[6] https://github.com/openjdk/jdk/pull/7805#discussion_r893275672
- relates to
-
JDK-8282526 Default icon is not painted properly
- Resolved
-
JDK-8182043 Access to Windows Large Icons
- Resolved