title: LoadLibraryEx function
body: <p>I am trying to use the LoadLibraryEx function however, it fails everytime and does not give me any proper error to know what is going wrong. Here is my code: </p>
  
  <pre><code> HMODULE h;
          h = LoadLibraryEx("C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Include\\LMJoin.h", NULL, 0x00000008);
          if(h!=NULL)
          {
              if (::GetModuleHandleExW(0, L"LMJoin.h", &amp;h))
              {
                  typedef BOOL (WINAPI *PGET_DOMAIN_INFO)(wchar_t const**, wchar_t**, _NETSETUP_JOIN_STATUS*);
                  PGET_DOMAIN_INFO getDomainInfo = (PGET_DOMAIN_INFO)GetProcAddress(h, "NetGetJoinInformation");
                  if (NULL != getDomainInfo)
                  {
                      nas = (getDomainInfo)(NULL, &amp;lpNameBuffer, &amp;BufferType);
                  }
              }
              FreeLibrary(h);
          }
          else
          {
              TRACE_ERR("LMJoin.h Library could not be loaded\n",GetLastError());
          }
  </code></pre>
  
  <p>Can someone help please?</p>