title: C# Dllimport problems in Visual Studio 2010 .NET framework 4
body: <p>I am trying to import a dll written in C++, in my C# application.
  The application is supposed to get names of disponible webcams. 
  It works well in .NET framework 3.5 (gets all names properly) but I have problems with getting names in framework 4. I get something like "„îş" instead.</p>
  
  <p>Here are fragments of my code :</p>
  
  <ul>
  <li><p>c++ dll :</p>
  
  <pre><code>TCHAR GetDeviceName(int index)
  {
      char name[255];
      GetDeviceNameAux(index, name);
      TCHAR retVal = (TCHAR)name;
      return retVal;
  }
  </code></pre></li>
  <li><p>c# application (that works for framework 3.5)</p>
  
  <pre><code>[DllImport("FindCaptureDevice.dll")]
  public static extern string GetDeviceName(int index);
  </code></pre></li>
  </ul>
  
  <p>I have tried also :</p>
  
  <pre><code>[DllImport("FindCaptureDevice.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
      public static extern string GetDeviceName(int index);
  </code></pre>
  
  <p>with different parameters for CallingConvention ans CharSet.</p>
  
  <p>Thanks in advance for any help.</p>