2
votes

I'm adding VC++ lib in my VB .Net program using for instance:

<DllImport("KMpeg4.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Shared Function KOpenInterface() As System.IntPtr
End Function

I've got at runtime the error:

Unable to load DLL 'KMpeg4.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I've put this lib everywhere, including system32, still no luck, which mean it missing dependent lib of KMpeg4.dll.

So I've run Dependency walker which gave me the missing lib:

API-MS-WIN-CORE-COM-L1-1-0.DLL  
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL  
API-MS-WIN-CORE-WINRT-L1-1-0.DLL  
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL  
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL  
API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL  
DCOMP.DLL
GPSVC.DLL  
IESHIMS.DLL

and the bad lnking function:

c:\windows\system32\API-MS-WIN-CORE-THREADPOOL-L1-1-0.DLL
c:\windows\system32\OLE32.DLL
c:\windows\system32\DWMAPI.DLL
c:\windows\system32\IEFRAME.DLL
c:\windows\system32\IMM32.DLL
c:\windows\system32\MFPLAT.DLL
c:\windows\system32\NDFAPI.DLL
c:\windows\system32\USERENV.DLL
c:\windows\system32\UXTHEME.DLL

dependency walker gives the following errors:

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.

I've I have already install Microsoft VC++ 2005,2008,2010 x86 and x64 and .Net framework 4.

As well I try to see if the KMpeg4.dll popup using sysinternal process monitor, but it does not load KMpeg4.dll befor the program get the error exception

Any ideas from which package those lib could come from?

or alternatively, how to get around this problem?

1
What Windows version are you using and what Windows version was the KMpeg4.dll meant for? From the names of the dependencies it looks like the KMpeg4 is meant for Windows 8 RT. Are you running Windows 7?Rudolfs Bundulis

1 Answers

2
votes

Dependency Walker is not useful to diagnose this problem, DLLs like this are found only at runtime. Copying into system32 is usually the sledge-hammer solution. Except on a 64-bit version of Windows with your project's Platform target set to x86, very likely in this case since this is surely a 32-bit DLL, you then need to hammer it into c:\windows\syswow64.

But don't do that, you just need to make sure that the DLL is present in the same directory as your project's EXE. Best way to do so:

  • Right-click your EXE project, Add + Existing item
  • Navigate to your copy of KMpeg4.dll and select it
  • Select the added item, set the Copy to Output Directory property to "Copy if newer"

Rebuild and you'll now have a copy of the DLL in the right place. Don't forget to deploy it along with your project's executables and don't forget the runtime support DLL that it might need on your user's machine.