Page 1 of 1 1
Topic Options
#131705 - 2004-12-21 10:13 PM Change file type association Icon.
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Guys:
I need to change a file association Icon, is it possible to do it with kix?

Thanks boys.
_________________________
Life is fine.

Top
#131706 - 2004-12-21 10:21 PM Re: Change file type association Icon.
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Yes.
Top
#131707 - 2004-12-21 10:23 PM Re: Change file type association Icon.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
ARGH! You just got through saying you are not a newbie but you posted a question like one.

The answer is "Yes" you can do it with KiX.

How about a little more detail...
Are you wanting to change just the icon of a shortcut or do you want to change all icons? What filetype? What icon are you wanting to show? Is it a separate icon file or another icon that is in the EXE it is now registered to?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#131708 - 2004-12-21 10:26 PM Re: Change file type association Icon.
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Here's a sample...

Code:

$rc = WriteValue("HKCR\kixfile\DefaultIcon", "", "%WINDIR%\system32\SHELL32.dll,21", "REG_SZ")


Top
#131709 - 2004-12-21 10:38 PM Re: Change file type association Icon.
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
LOL. Maybe I am still a newby then or what is more and less the same, never stop to be one. Fortunatly Jens is not arround to punish me.

The file type is already registered, what I manually do is to browse the icon of that specific type and replace with another .ico. The types are .doc and .xls.

To be honest I am doing this cause I am trying to implement Open Office and ppl dont get use to it. I found out that replacing the icons to the standard office (just the icon draw) give more confidence. And the cheat works.
Please dont laught.
_________________________
Life is fine.

Top
#131710 - 2004-12-21 10:46 PM Re: Change file type association Icon.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Maybe Jens is not around but I am. What... you not afraid of me?

If you changed the icon through the GUI, you should be able to go look in HKCR for the change and then modify Chris' example to suit.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#131711 - 2004-12-21 10:54 PM Re: Change file type association Icon.
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
No Les I am not the thing is that Jens had corrected me so many times that I do the asociation but if you want I can be afraid of you too.

Thanks Chris basta IŽll follow your sample.
_________________________
Life is fine.

Top
#131712 - 2004-12-21 10:58 PM Re: Change file type association Icon.
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
To extend my example and wrap it in a function...

Code:

fnChangeDefaultIcon('.kix','%WINDIR%\system32\SHELL32.dll,21')
@ERROR " | " @SERROR ?

Function fnChangeDefaultIcon($sExtension,$sIcon)
Dim $sFileType,$rc
$sFileType = ReadValue('HKCR\' + $sExtension,'')
$rc = WriteValue('HKCR\' + $sFileType + '\DefaultIcon', '', $sIcon, 'REG_SZ')
Exit @ERROR
EndFunction


Top
#131713 - 2004-12-21 11:08 PM Re: Change file type association Icon.
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Tested. It works, but to have it take effect immediately you'll have to stop and restart your shell (e.g. kill explorer.exe and restart explorer.exe).
Top
#131714 - 2004-12-21 11:17 PM Re: Change file type association Icon.
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Thanks very much Chris I can try with EnumProcess().
_________________________
Life is fine.

Top
#131715 - 2005-01-04 12:57 AM Re: Change file type association Icon.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
UpdateUserParameters() might be able to do the same without killing the process.

Oh, and BOOH! Are you scared now ;-)
_________________________
There are two types of vessels, submarines and targets.

Top
#131716 - 2005-01-04 04:49 PM Re: Change file type association Icon.
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I tried this with with UpdateUserParameters(), but it did not immediately refresh the displayed icon. :-(

P.S. I'm not sure what happened with the original links I provided, because when I did the preview before posting they looked fine. Thanks to Jooel and Doc for fixing it for me.

Top
#131717 - 2005-01-04 07:27 PM Re: Change file type association Icon.
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
I think the problem you are having may be slightly different than the one I once was having, but I thought I would suggest the code that worked for me:

Code:
  
function refreshdesktop()
SetFocus("Program Manager")
SendKeys("{F5}")
endfunction

_________________________
(... better days ahead)

Top
#131718 - 2005-01-04 08:13 PM Re: Change file type association Icon.
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Nope. No worky.
Top
#131719 - 2005-01-10 11:14 AM Re: Change file type association Icon.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now, is the problem only showing on desktop?
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1046 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.055 seconds in which 0.013 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org