Repair TIF file associations in XP

G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.print_fax (More info?)

Hello,

I'm trying to identify the registry keys needed in order to
programmatically reset TIF file associations to their default
(Microsoft Picture and Fax Viewer) in XP. I'm having a very tough time
getting it right.

I have tried several different methods, and I'm mystified. There is a
great little utility written by Ramesh Srinivasan
(http://windowsxp.mvps.org/imgassofix.htm) that works perfectly for
such a purpose (check TIF and TIFF checkboxes and click Repair
Associations), yet I can't seem to emulate the functionality in my
code.

Here are two methods that I've tried but don't work for me:


METHOD #1 - Registry File (Thanks to Doug Knox)

********** Registry File Listing : BEGIN ********
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.tiff]
"Content Type"="image/tiff"
"PerceivedType"="image"
@="TIFImage.Document"
[HKEY_CLASSES_ROOT\.tiff\OpenW­ithProgids]
"TIFImage.Document"=hex(0):
[HKEY_CLASSES_ROOT\.tiff\Persi­stentHandler]
@="{098f2470-bae0-11cd-b579-08­002b30bfeb}"
[HKEY_CLASSES_ROOT\.tif]
"Content Type"="image/tiff"
"PerceivedType"="image"
@="TIFImage.Document"
[HKEY_CLASSES_ROOT\.tif\OpenWi­thProgids]
"TIFImage.Document"=hex(0):
[HKEY_CLASSES_ROOT\.tif\Persis­tentHandler]
@="{098f2470-bae0-11cd-b579-08­002b30bfeb}"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument]
"EditFlags"=dword:00010000
"FriendlyTypeName"=hex(2):40,0­0,25,00,53,00,79,00,73,00,74,0­0,65,00,6d,00,52,\

00,6f,00,6f,00,74,00,25,00,5c,­00,53,00,79,00,73,00,74,00,65,­00,6d,00,33,00,\

32,00,5c,00,73,00,68,00,69,00,­6d,00,67,00,76,00,77,00,2e,00,­64,00,6c,00,6c,\

00,2c,00,2d,00,33,00,30,00,36,­00,00,00
"ImageOptionFlags"=dword:00000­000
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\DefaultIcon]
@="shimgvw.dll,4"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell]
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\open]
"MuiVerb"="@shimgvw.dll,-550"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\open\command]
@="rundll32.exe
C:\\WINDOWS\\System32\\shimgvw­.dll,ImageView_Fullscreen %1"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\open\DropTarget]
"Clsid"="{E84FDA7C-1D6A-45F6-B­725-CB260C236066}"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\printto]
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\printto\command]
@="rundll32.exe C:\\WINDOWS\\System32\\shimgvw­.dll,ImageView_PrintTo
/pt \"%1\" \"%2\" \"%3\" \"%4\""
************* Registry File Listing: END **********



METHOD #2 - VBScript File (Thanks to Ramesh Srinivasan)

************* VBScript File Listing: BEGIN **********
Option Explicit

Dim WSHShell

Set WSHShell = WScript.CreateObject("WScript.­Shell")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\E­ditFlags",
"65536", "REG_DWORD")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\F­riendlyTypeName",
"@%SystemRoot%\system32\shimgv­w.dll,-306", "REG_EXPAND_SZ")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\I­mageOptionFlags",
"0", "REG_DWORD")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\D­efaultIcon\",
"shimgvw.dll,4", "REG_SZ")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\s­hell\open\MuiVerb",
"@shimgvw.dll,-550", "REG_SZ")

************* VBScript File Listing: END **********



If I manually change the TIF file association to something like MODI or
MSPaint, and then use Ramesh's utility, it restores it perfectly, but
neither of these other methods seems to restore them correctly; the
associations remain as what I changed them to. Is it dependent upon
the current user? Is there some additional action or key that must be
changed to activate the new association?

Can anyone please shed some light on this for me? Also, anyone know
how to do the same thing in Server 2003?

Thank you very much -
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.print_fax (More info?)

http://members.shaw.ca/bsanders/FAQFAX.htm#_Toc88835135

--
Russ Valentine
[MVP-Outlook]
"DrEeveal" <csanders1989@yahoo.com> wrote in message
news:1121450924.419679.208720@g14g2000cwa.googlegroups.com...
Hello,

I'm trying to identify the registry keys needed in order to
programmatically reset TIF file associations to their default
(Microsoft Picture and Fax Viewer) in XP. I'm having a very tough time
getting it right.

I have tried several different methods, and I'm mystified. There is a
great little utility written by Ramesh Srinivasan
(http://windowsxp.mvps.org/imgassofix.htm) that works perfectly for
such a purpose (check TIF and TIFF checkboxes and click Repair
Associations), yet I can't seem to emulate the functionality in my
code.

Here are two methods that I've tried but don't work for me:


METHOD #1 - Registry File (Thanks to Doug Knox)

********** Registry File Listing : BEGIN ********
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.tiff]
"Content Type"="image/tiff"
"PerceivedType"="image"
@="TIFImage.Document"
[HKEY_CLASSES_ROOT\.tiff\OpenW­ithProgids]
"TIFImage.Document"=hex(0):
[HKEY_CLASSES_ROOT\.tiff\Persi­stentHandler]
@="{098f2470-bae0-11cd-b579-08­002b30bfeb}"
[HKEY_CLASSES_ROOT\.tif]
"Content Type"="image/tiff"
"PerceivedType"="image"
@="TIFImage.Document"
[HKEY_CLASSES_ROOT\.tif\OpenWi­thProgids]
"TIFImage.Document"=hex(0):
[HKEY_CLASSES_ROOT\.tif\Persis­tentHandler]
@="{098f2470-bae0-11cd-b579-08­002b30bfeb}"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument]
"EditFlags"=dword:00010000
"FriendlyTypeName"=hex(2):40,0­0,25,00,53,00,79,00,73,00,74,0­0,65,00,6d,00,52,\

00,6f,00,6f,00,74,00,25,00,5c,­00,53,00,79,00,73,00,74,00,65,­00,6d,00,33,00,\

32,00,5c,00,73,00,68,00,69,00,­6d,00,67,00,76,00,77,00,2e,00,­64,00,6c,00,6c,\

00,2c,00,2d,00,33,00,30,00,36,­00,00,00
"ImageOptionFlags"=dword:00000­000
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\DefaultIcon]
@="shimgvw.dll,4"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell]
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\open]
"MuiVerb"="@shimgvw.dll,-550"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\open\command]
@="rundll32.exe
C:\\WINDOWS\\System32\\shimgvw­.dll,ImageView_Fullscreen %1"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\open\DropTarget]
"Clsid"="{E84FDA7C-1D6A-45F6-B­725-CB260C236066}"
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\printto]
[HKEY_CLASSES_ROOT\TIFImage.Do­cument\shell\printto\command]
@="rundll32.exe C:\\WINDOWS\\System32\\shimgvw­.dll,ImageView_PrintTo
/pt \"%1\" \"%2\" \"%3\" \"%4\""
************* Registry File Listing: END **********



METHOD #2 - VBScript File (Thanks to Ramesh Srinivasan)

************* VBScript File Listing: BEGIN **********
Option Explicit

Dim WSHShell

Set WSHShell = WScript.CreateObject("WScript.­Shell")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\E­ditFlags",
"65536", "REG_DWORD")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\F­riendlyTypeName",
"@%SystemRoot%\system32\shimgv­w.dll,-306", "REG_EXPAND_SZ")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\I­mageOptionFlags",
"0", "REG_DWORD")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\D­efaultIcon\",
"shimgvw.dll,4", "REG_SZ")
Call
WshShell.RegWrite("HKLM\SOFTWA­RE\Classes\TIFImage.Document\s­hell\open\MuiVerb",
"@shimgvw.dll,-550", "REG_SZ")

************* VBScript File Listing: END **********



If I manually change the TIF file association to something like MODI or
MSPaint, and then use Ramesh's utility, it restores it perfectly, but
neither of these other methods seems to restore them correctly; the
associations remain as what I changed them to. Is it dependent upon
the current user? Is there some additional action or key that must be
changed to activate the new association?

Can anyone please shed some light on this for me? Also, anyone know
how to do the same thing in Server 2003?

Thank you very much -