ExplorerListGadget - nada icons for *.exe

Windows specific forum
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

ExplorerListGadget - nada icons for *.exe

Post by Danilo »

Code: Select all

If OpenWindow(0,0,0,450,500,"ExplorerListGadget",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
    ExplorerListGadget(0, 0, 0, 450, 500, "C:\*.exe;*.dll;*.ico",#PB_Explorer_FullRowSelect)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Does not display the *.exe icons with PureBasic 4.60 x86.

Displays *.exe icons with PB 4.60 x64.
Icons for other file types are displayed, but not the *.exe icons.
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Shardik »

Danilo wrote:Does not display the *.exe icons with PureBasic 4.60 x86.
I can't confirm this finding. All icons of .exe files are displayed correctly
using Danilo's example code.

Tested systems:
Windows 7 SP1 Enterprise Edition x86 (updated with Microsoft's newest patches from Tuesday just before testing :wink:)
Windows XP SP3 Professional x86
Last edited by Shardik on Thu Dec 15, 2011 12:13 pm, edited 1 time in total.
User avatar
Lord
Addict
Addict
Posts: 907
Joined: Tue May 26, 2009 2:11 pm

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Lord »

Danilo wrote:Does not display the *.exe icons with PureBasic 4.60 x86.
I can't confirm this finding, too.
PB4.60(x68) and PB4.60(x64) are showing the same Icons.

My OS:
Windows 7 Ultimate - SP1
Image
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Danilo »

My OS: Windows 7 Ultimate 64bit - SP1 - all windows updates (last updated yesterday).
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by ts-soft »

My OS: Windows 7 Ultimate 64bit - SP1 - all windows updates (last updated yesterday).

I can't confirm this

Greetings - Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
einander
Enthusiast
Enthusiast
Posts: 744
Joined: Thu Jun 26, 2003 2:09 am
Location: Spain (Galicia)

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by einander »

Image
_______________________________
Using Danilo's example code.
PureBasic 4.60 (Windows - x86)
My OS: Windows 7 Ultimate 32bit - SP1 - all windows updates (last updated yesterday).
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by IdeasVacuum »

..... as a 32bit app, it will not display exe icons that are 64bit? Similar to Windows Explorer on 32bit - if you place a 64bit app anywhere, Windows does not display the icon.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Fred
Administrator
Administrator
Posts: 18225
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Fred »

Seems to work fine here (Win 7 64 bit, using PB x86). Can anybody else confirm ?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Trond »

Have you tried to rebuild the icon cache?
http://www.winhelponline.com/blog/how-t ... ows-vista/
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Danilo »

Trond wrote:Have you tried to rebuild the icon cache?
Thank you, but did not work. All icons show fine, except .EXE icons
in PB's ExplorerListGadget.
I think it is how PB extracts the icons from .EXEs.
Fred
Administrator
Administrator
Posts: 18225
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Fred »

We do use the regular SHGetFileInfo() function. May be you can test on your computer to see if it returns an icon.

Here is the C code:

Code: Select all

    ZeroMemory(&shFileInfo, sizeof(SHFILEINFO));
    SHGetFileInfo(Filename, 0, &shFileInfo, sizeof(SHFILEINFO), SHGFI_TYPENAME | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
    strcpy(ResultBuffer, &shFileInfo.szTypeName[0]);
    *TypeName = ResultBuffer;

    return shFileInfo.iIcon;
Fred
Administrator
Administrator
Posts: 18225
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Fred »

Any chances ?
User avatar
einander
Enthusiast
Enthusiast
Posts: 744
Joined: Thu Jun 26, 2003 2:09 am
Location: Spain (Galicia)

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by einander »

Danilo's code still displays correctly all the .exe icons.
PureBasic 5.00 beta 5 (Windows - x86)
My OS: Windows 7 Ultimate 32bit - SP1 - all windows updates.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Danilo »

Fred wrote:Any chances ?
It still does not work here on my system. OpenFileRequester() with PB 32bit does not show
.EXE icons too, so it looks like an issue with my system only, not directly a PureBasic bug.

Tested code on Win 7 64bit Ultimate, using PureBasic 4.61 x86:

Code: Select all

;
; http://www.purebasic.fr/english/viewtopic.php?f=4&t=48559
;

CoInitialize_(0) ; required for SHGetFileInfo_()

;InitCommonControlsEx_()

;FileIconInit_(0)

lib = LoadLibrary_("shell32.dll")
If lib
    address = GetProcAddress_(lib,660)
    If address
        Debug "Calling FileIconInit"
        CallFunctionFast(address,1)
    EndIf
EndIf

If OpenWindow(0,0,0,450,500,"ExplorerListGadget",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
    ExplorerListGadget(0, 0, 0, 450, 500, "C:\*.exe;*.dll;*.ico");,#PB_Explorer_FullRowSelect)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

Procedure ShowIcon(hIcon)
    OpenWindow(0,0,0,200,200,"Icon",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
    ImageGadget(0,0,0,200,200,hIcon)
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndProcedure

Procedure Info( Filename.s )
    shFileInfo.SHFILEINFO
    Debug Filename
    Debug SHGetFileInfo_(@Filename, 0, @shFileInfo, SizeOf(SHFILEINFO), #SHGFI_TYPENAME | #SHGFI_SYSICONINDEX | #SHGFI_SMALLICON );| #SHGFI_ICON)
    Debug shFileInfo\iIcon
    Debug shFileInfo\hIcon
    Debug PeekS(@shFileInfo\szTypeName[0])
EndProcedure

Procedure Info2( Filename.s )
    shFileInfo.SHFILEINFO
    Debug Filename
    Debug SHGetFileInfo_(@Filename, 0, @shFileInfo, SizeOf(SHFILEINFO), #SHGFI_TYPENAME | #SHGFI_SYSICONINDEX | #SHGFI_SMALLICON | #SHGFI_DISPLAYNAME )
    Debug shFileInfo\iIcon
    Debug shFileInfo\hIcon
    Debug PeekS(@shFileInfo\szTypeName[0])
    Debug PeekS(@shFileInfo\szDisplayName[0])

    If GetExtensionPart(Filename)="exe"
        ;
        ; extract icon
        ;
        shFileInfo\hIcon = ExtractIcon_(0,@Filename,0)
        If shFileInfo\hIcon > 1
            ShowIcon(shFileInfo\hIcon)
            DestroyIcon_(shFileInfo\hIcon)
        EndIf

        ;
        ; extract big icon
        ;
        If ExtractIconEx_(@Filename,0,@shFileInfo\hIcon,0,1)
            ShowIcon(shFileInfo\hIcon)
            DestroyIcon_(shFileInfo\hIcon)
        EndIf

        ;
        ; extract small icon
        ;
        If ExtractIconEx_(@Filename,0,0,@shFileInfo\hIcon,1)
            ShowIcon(shFileInfo\hIcon)
            DestroyIcon_(shFileInfo\hIcon)
        EndIf
        
    EndIf

    hIcon = ExtractAssociatedIcon_(0,@FileName,@w.w)
    If hIcon
        ShowIcon(hIcon)
        DestroyIcon_(hIcon)
    EndIf
EndProcedure


Info( "c:\Windows\calc.exe" )
Debug "-----------------"
Info( "c:\Windows\advapi32.dll" )

Debug "-----------------"

Info2( "c:\Windows\calc.exe" )
Debug "-----------------"
Info2( "c:\Windows\advapi32.dll" )

CoUninitialize_()
My Debugger output:

Code: Select all

Calling FileIconInit
c:\Windows\calc.exe
5927960
0
0
Application
-----------------
c:\Windows\advapi32.dll
5927960
179
0
Application extension
-----------------
c:\Windows\calc.exe
5927960
0
0
Application
calc
-----------------
c:\Windows\advapi32.dll
5927960
179
0
Application extension
advapi32.dll
So the only 'workaround' would be to use ExtractIcon_(), ExtractIconEx_() (with small and big icons)
and maybe ExtractAssociatedIcon_() to get the real .EXE icon.
If this functions do not return a icon (the .EXE does not have an internal icon), use the System Image List icon returned by SHGetFileInfo_().

Looks like I am the only one having this issue, so I wouldn't call it an important bug. I am running this system
for a long time (when Win7 came out) and installed quite a lot of big commercial applications over that time,
so it could be a system issue just here on my system.
Fred
Administrator
Administrator
Posts: 18225
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [4.60 x86] ExplorerListGadget - nada icons for *.exe

Post by Fred »

If the regular OpenRequester() doesn't display the icons as well, we can conclude there is something wrong with your setup, i don't think it worths a workaround.
Post Reply