title: Unable to load DLL (Module could not be found HRESULT: 0x8007007E)
body: <p>I have a dll library with unmanaged C++ API code I need to use in my .NET 4.0 application. But every method I try to load my dll I get an error:</p>
  <blockquote>
  <p>Unable to load DLL 'MyOwn.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)</p>
  </blockquote>
  <p>I have read and tried several solutions I have found on the internet. Nothing works..</p>
  <p>I have tried using following methods:</p>
  <pre><code>[DllImport(&quot;MyOwn.dll&quot;,  CallingConvention = CallingConvention.Cdecl)]
  [return: MarshalAs((UnmanagedType.I4))]
  public static extern Int32 MyProIni(string DBname, string DBuser_pass,
      string WorkDirectory, ref StringBuilder ErrorMessage);
  </code></pre>
  <p>When I tried following <a href="http://www.c-sharpcorner.com/uploadfile/tanmayit08/unmanaged-cpp-dll-call-from-managed-C-Sharp-application/" rel="noreferrer">this article</a> and when I run this example (from the downloaded code) it runs without a problem (the dll used is in the bin/debug folder)</p>
  <p>I have copied my dll (along with all the files the it depends on into my bin folder).</p>
  <p>I also tried this approach but got the same error:</p>
  <pre><code>[DllImportAttribute(MyOwnLibDllPath, EntryPoint=&quot;TMproIni&quot;)]
  [return: MarshalAs(UnmanagedType.I4)]
  public static extern  int MyproIni(string DBname, string DBuser_pass, 
      string WorkDirectory, ref StringBuilder ErrorMessage);
  </code></pre>
  <p>Any suggestions?</p>