Ace128 has asked for the wisdom of the Perl Monks concerning the following question:

Hey,

It could seem redundant, but I'm trying to do "Explorer" with Perl and Tk here. Why? Well, kinda a proof-of-concept deal. Besides, I can make it as I wanna have it! I know Tk is rather limited when it comes to some OS specific things (and maybe I should do it with Tcl::Tk even), but I already have parts done in Tk and I know Tk best atm. So, how to get the icon associated with a surtain filetype in Perl? And, second question... What module is prefered here? I was thinking going for a matrix module (for the browseing view). It leans towards Tk::Mlistbox, since it has support for sorting and resizeing the columns. However, if I wanna display icons? I'm not sure, but I couln't find anything about adding images (icons) in Mlistbox. Either way, it would be cool knowing if there was a way to get the icons used in windows per filetype. That is, I dont mind if this only gonna work in windows because usage of Win32::XXX modules. Sure, there is:
my $folderimage = $pane->Getimage("folder"); my $fileimage = $pane->Getimage("file"); my $srcimage = $pane->Getimage("srcfile"); my $textimage = $pane->Getimage("textfile");
but its rather limited as you can see.

Furthermore I was hoping to use this trick with say Hlist aswell, to display correct icons...

So, feedback are greatly welcomed here as I was thinking doing this as a module, which one can just insert in your own frame and access its nice methods to change the data...

Thanks,
Ace

Replies are listed 'Best First'.
Re: "Correct" icons in selfbuild "Explorer"
by zentara (Cardinal) on Jul 30, 2006 at 19:15 UTC
    I'm not entirely clear what you are trying to do, and I don't mess with windows, but you might find zicons-Tk-Icon-Selector interesting.

    Are you trying to extract the icons out of Explorer? You might run into them being "inlined" right into the binary or some resource dll. It's not really a Tk question.


    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      After some extra digging, it seems like Win32::Exe could be the answer as this seems to be able of extracting icons... However, its litte tricky since there seems to be several icons. Best would be to somehow access the registry and extract exactly which .ico is used from the associated .exe file! Tricky, but cool to solve in Perl :) Anyone here done it already maybe? ;)