[Solved]How to programmatically determine if an external .exe has embedded icons lazarus / 67-Windows ---------------------------------------------------------------------- Ten_Mile_Hike · 2023-08-29 16:50 Hi, Simplest code to determine presence of embedded icon. NO NEED TO EXTRACT, just looking for presence Thank You ---------------------------------------------------------------------- Fibonacci · 2023-08-29 17:02 You are in luck, I happen to have such code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses Windows; function resenumtypes(hModule: HMODULE; lpType: LPSTR; lParam: LONG_PTR): BOOL; stdcall;begin  result := true;   if lpType = RT_ICON then begin    PBoolean32(lParam)^ := true;     result := false; //stop enumerating  end;end; var  h: hwnd;  has_icon: boolean = false; begin  h := LoadLibraryEx('C:\Windows\explorer.exe', 0, LOAD_LIBRARY_AS_IMAGE_RESOURCE+LOAD_LIBRARY_AS_DATAFILE);   if h > 0 then begin    EnumResourceTypes(h, @resenumtypes, LONG_PTR(@has_icon));     writeln('has icon? ', has_icon);  end else begin    writeln('cant open file');  end;   readln;end. ---------------------------------------------------------------------- rvk · 2023-08-29 17:10 Quote from: Fibonacci on August 29, 2023, 07:02:52 pmYou are in luck, I happen to have such code I'm not sure if ANY icon is what is asked for or the actual program icon. Your code looks for ANY icon (of I'm not mistaken)? You can use ExtractIconEx for the actual program icon. https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf- shellapi-extracticonexa You can probably use the ExtractIcon function for this. ---------------------------------------------------------------------- Fibonacci · 2023-08-29 17:13 He didn't specify it has to be MAINICON ---------------------------------------------------------------------- rvk · 2023-08-29 17:21 Quote from: Fibonacci on August 29, 2023, 07:13:45 pmHe didn't specify it has to be MAINICON No (s)he didn't but seeing that only the presence is requested it would make sense it would be the MAINICON. Anyway, now both methods are documented in this topic ---------------------------------------------------------------------- Ten_Mile_Hike · 2023-08-29 21:28 Thank You