Using XP's shimgvw.dll in Windows 7 RRS feed

  • Question

  • I have a legacy application built for WinXP. I do not have its source codes I tried to run it on Win7. However, I met into the following errors.

    Error 1

    When the app tries to open an image to view it, it throws error "Class not registered". I used Process Monitor to find out that the app actually was looking for the key HKCR\CLSID\{50F16B26-467E-11D1-8271-00C04FC3183B}, which is missing in Win7. When I did a search in WinXP, I found out that class belongs to C:\WINDOWS\System32\shimgvw.dll.

    To solve this error, I copied the XP version of shimgvw.dll to Win7 machine (put in location C:\<app exe location>). I also manually created the exact same set of keys (HKCR\CLSID\{50F16B26-467E-11D1-8271-00C04FC3183B}\......) in Win7 as those found in WinXP (except that registry vaue location of shimgvw.dll is set to C:\<app exe location>, and not C:\WINDOWS\system32). This solved the "Class not registered" problem but introduced Error 2.

    Error 2

    The first time that the app tries to open an image to view it, it throws an error "A dynamic link library (DLL) initialization routine failed.". However, subsequent attempts to view the image work - Win7 Photo viewer was launched to view the image (and not the WinXP Photo and Fax Viewer). The error shows only at the first attempt to view an image after the application startup.

    I also noted from Process Monitor that C:\WINDOWS\System32\shunimpl.dll was loaded at the first attempt to view the image. But it wasn't loaded on subsequent attempts. Not sure if this information is helpful.


    I just want my app to be able to open an image to view it without throwing any error messages. I don't really care whether the XP Photo Viewer or Win7 Photo Viewer is used.  I just started out with Process Monitor so am not very good in using it for troubleshooting. Appreciate any advice to help solve this. Many thanks.


    • Edited by seveleven Monday, March 4, 2013 4:16 PM
    Monday, March 4, 2013 4:12 PM

All replies

  • Hi,

    Due to this a legacy program, we cannot ensure it is compatible with Windows 7,  because windows 7 and windows XP are different platforms, I think you should know this point.

    But you can try the compatibility mode to see if it workaround this issue.

    Or there is another choice:

    Configure Your Windows 7 System to Run Legacy Apps in a Virtualized Windows XP Environment


    Alex Zhao
    TechNet Community Support

    Wednesday, March 6, 2013 8:20 AM
  • I prefer not to go virtualized.

    My app is already running in XP compatibility mode (through Properties -> Compatibility tab).

    There must be a way to suppress the first error message "A dynamic link library (DLL) initialization routine failed." through tweaks in the registry.  Why does the error only appear on the 1st attempt to open an image? All subsequent attempts to load images works perfect (as long as my application is not restarted). So, seems like it is not entirely impossible to use XP's shimgvw.dll. Just need to know how to avoid the first error message.

    Microsoft should have provided a workaround for XP applications using COM classes in shimgvw.dll to work seamlessly in Win 7.

    Update: Following the methods in "http : // ask-leo .com / comments_003254.php ? page=7" , I can change the default viewer to XP Picture and Fax Viewer. My app will open images using XP Picture and Fax Viewer. However, the error ("A dynamic link library (DLL) initialization routine failed." ) still appears on the 1st attempt to open an image.



    • Edited by seveleven Thursday, March 7, 2013 1:30 AM update
    Wednesday, March 6, 2013 6:03 PM