Problems with string in DLL and WinHttpClient

 

Hi,

i try to send a string from mql to dll and work with them...

 Code in MQL:

#import "myDLL.dll"
    bool SetString(string foo);
#import
//+-------------------------------------------------------+
int start() {
    string foo = "bar";
    SetString(foo);
}

Code in DLL (taken from http://www.codeproject.com/Articles/66625/A-Fully-Featured-Windows-HTTP-Wrapper-in-C)

bool SetString(string foo) {

    // Set URL.
    WinHttpClient client(L"http://myurl.de/script.php");

    // Set post data.
    string data = "foo="+foo;
    client.SetAdditionalDataToSend((BYTE *)data.c_str(), data.size());
 
    // Set request headers.
    wchar_t szSize[50] = L"";
    swprintf_s(szSize, L"%d", data.size());
    wstring headers = L"Content-Length: ";
    headers += szSize;
    headers += L"\r\nContent-Type: application/x-www-form-urlencoded\r\n";
    client.SetAdditionalRequestHeaders(headers);
 
    // Send HTTP post request.
    client.SendHttpRequest(L"POST");
 
    wstring httpResponseHeader = client.GetResponseHeader();
    wstring httpResponseContent = client.GetResponseContent();
}

 Now, I use Wireshark to monitor my HTTP Traffic and the DLL send only http://myurl.de/script.php?foo= without the variable.

 What's wrong in the code. I tried several ways to transfer the string to DLL... 

 
No Idea? No Hint?