The MASM Forum
General => The Campus => Topic started by: xandaz on May 30, 2012, 08:53:46 AM
-
i'm making a rar extractor and while the content of the file is still compacted i need to extract either the index or handle of the icon that corresponds to the extention. I'm not aware of any function that could do so. I tried ExtracAssociatedIconEx and ExtractIcon with 0 for module Instance but didn't work. Can it be done via registry. Does anybody have any idea? Thanks in advance.
Laters
X
-
Stay OUT of the Registry. Use SHGetFileInfo
Something like this should work:
invoke SHGetFileInfo, offset szExtension, NULL, offset sfi, sizeof SHFILEINFO, SHGFI_SYSICONINDEX or SHGFI_USEFILEATTRIBUTES or SHGFI_ICON or SHGFI_SMALLICON
invoke ImageList_AddIcon, himlTabs, sfi.hIcon
invoke DestroyIcon, sfi.hIconthis will fill in the icon index in the system imagelist sfi.iIcon and the handle of the icon sfi.hIcon
-
yea? but does it work with just the extention? what's the format?
*.rar...cause i tried that and didnt work.
thanks gunner i appreciate the help. I'm waittin.
soon
-
oh yeah gunner. after reading the sdk i understood. thanks gunna.
later and regards
x
-
Couldn't get it to work... does anyone know what's the extention fomat? Is it '*.ext',0 or what?
-
try passing a "fictional" filename. like 'x.rar',0
also - set the SHFILEINFO dwAttributes member to FILE_ATTRIBUTE_NORMAL before the call
-
thanks dave. will do so... i'll let you know how it went.
-
Not working.... even tried FILE_ATTR_COMPRESSED and both and none.
-
alright - let me play with it...
-
wait....it works.... it was an listview problem.... forgot to xor imask,LVIF_IMAGE+PARAM that's all. Sorry.... i always miss something stupid. Thanks dave and gunner
-
yah - my mistake, too
you set the file attribute in the parm - not in the struct...
INVOKE SHGetFileInfo,offset szExtension,FILE_ATTRIBUTE_NORMAL,offset shfi,sizeof SHFILEINFO,
SHGFI_SYSICONINDEX or SHGFI_USEFILEATTRIBUTES or SHGFI_ICON or SHGFI_SMALLICON
also - it appears that '.rar',0 will work for an extension format
-
oks.... althought i read here...http://blogs.msdn.com/b/oldnewthing/archive/2004/06/01/145428.aspx (http://blogs.msdn.com/b/oldnewthing/archive/2004/06/01/145428.aspx)
thx dave. i appreciate it.... i'm coming close to about 2000 lines of code devided be several source files. I feel tired. I'll prolly drop once i get bored as i do with everything else....lol. bb
-
yah - i saw that article
but - you may also want to read the community content at the bottom...
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762179%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/bb762179%28v=vs.85%29.aspx)
-
thx. dave. will do.