Problems compiling ActiveX wrapper


#1

Seems like the juce::String class changed recently. Perhaps operator const char *() was removed or something? I get compile errors in the getExeVersion() function wherever a string is passed to windows.

My cygwin git is playing silly buggers with me so I can’t make a patch but the following 4 lines fix this.

[code]+static const String getExeVersion (const String& exeFileName, const String& fieldName)
{
String resultString;
DWORD pointlessWin32Variable;

  • DWORD size = GetFileVersionInfoSize (exeFileName.toCString(), &pointlessWin32Variable);
if (size > 0)
{
    HeapBlock <char> exeInfo;
    exeInfo.calloc (size);
  •    if (GetFileVersionInfo (exeFileName.toCString(), 0, size, exeInfo))
      {
          TCHAR* result = 0;
          unsigned int resultLen = 0;
    
          // try the 1200 codepage (Unicode)
          String queryStr ("\\StringFileInfo\\040904B0\\" + fieldName);
    
  •        if (! VerQueryValue (exeInfo, (LPTSTR) (LPCTSTR) queryStr.toCString(), (void**) &result, &resultLen))
          {
              // try the 1252 codepage (Windows Multilingual)
              queryStr = "\\StringFileInfo\\040904E4\\" + fieldName;
    
  •            VerQueryValue (exeInfo, (LPTSTR) (LPCTSTR) queryStr.toCString(), (void**) &result, &resultLen);
          }
    
          resultString = String (result, resultLen);
      }
    

    }

    return resultString;
    }[/code]


#2

No, I don’t think that’s right - it should be implicitly cast to a juce_wchar*. You don’t want a char*, because it should be calling the wide-char version of GetFileVersionInfoSize…


#3

You’re right! False alarm. It was stemming from a compiler flag issue with a new build system I’m using. Urgh. Sorry!