title: How to fix DWMAPI.DLL delay-load dependency under WinXP?
body: <p>I have built a .dll under WinXP that claims it can't find DWMAPI.DLL when it's loaded. The problem is that this DLL is a Vista DLL, and this a known issue for XP users that have IE7 installed. The recommendation is to uninstall IE7 or repair the .NET Framework via Add/Remove programs. I did the repair, and nothing changed. I'm not about to uninstall IE7 since there must be a better solution that's not the equivalent of "reinstall windows".</p>
  
  <p>I've read bad things about people who attempted to uninstall IE7, so I'm reluctant to go that route.</p>
  
  <p>I am using C++ under Visual Studio 2003 (7.1). I don't see an option where I may have forced delay loading at application launch. I just used default settings when I created the DLL project. I did just now find an interesting option, Linker->Input->Delay Loaded DLLs, so I put DWMAPI.DLL in there to force it to be delay-loaded. However, I get this when linking:</p>
  
  <pre><code>LINK : warning LNK4199: /DELAYLOAD:dwmapi.dll ignored; no imports found from dwmapi.dll
  </code></pre>
  
  <p>.. and it of course didn't change a thing when trying to load my DLL. For the heck of it, I added the whole tree of DLLs that lead to DWMAPI.DLL, and I get the same message. (For the record, it's foundation.dll->shell32.dll->shdocvw.dll->mshtml.dll->ieframe.dll->dwmapi.dll .)</p>
  
  <p>To be more specific about what I'm doing, I am writing a Maya plugin and get the always-helpful text in the script editor:</p>
  
  <pre><code>// Error: Unable to dynamically load : D:/blahblahblah/mydll.mll
  The specified module could not be found.
   //
  // Error: The operation completed successfully.
   //
  // Error: The operation completed successfully.
   (mydll) //
  </code></pre>
  
  <p>I used Dependency Walker to initially track down the problem, and that's what lead me to DWMAPI.DLL. These are the message depends gives me, and DWMAPI.DLL is the only thing that has a yellow question mark next to it:</p>
  
  <pre><code>Warning: At least one delay-load dependency module was not found.
  Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
  </code></pre>
  
  <p>Gerald is right. Maya is, in fact, using a different PATH than the Dependency Walker. My plug-in loads another DLL (for image processing) that lives in the Maya plug-ins directory and depends found it with no problem, but Maya didn't. I had to add ";plug-ins" to the PATH in Maya.env.</p>
  
  <p>Seeing as this problem wasn't related to DWMAPI.DLL after all, but DWMAPI is a common problem, I'll post the best link I found about the DWMAPI issue on Novell's website <a href="http://www.novell.com/communities/node/4372/handling-dwmapidll-dependency" rel="noreferrer">here</a>. Basically, most programs will have this warning in depends.exe, but if there is a delay-load icon next to it, and you are sure that the program won't directly or indirectly call DWMAPI, then it's fine. The problem is elsewhere. If the delay-load icon isn't present, then you have to look at the /DELAY and /DELAYLOAD options in Visual Studio. The fact that depends gave me a "warning" and not an "error" was a clue to the fact that DWMAPI is not being loaded automatically.</p>