ingalime wrote:- Code: Select all
String link = Format(_D("http://rzaripov.kz/pushTest/api.php?method=saveToken&deviceID=%s&deviceToken=%s&platform=%s"),
ARRAYOFCONST(( FDeviceID, FDeviceToken, sPlatform )));//error
[bccaarm Error] myfile.cpp(132): 'this' cannot be implicitly captured in this context 
Add 'this' to the capture list of the lambda:
- Code: Select all
void __fastcall TForm1::RegisterDevice()
{
TTask::Run([this]()
{
...
}
);
}
Otherwise, capture the individual variables directly:
- Code: Select all
void __fastcall TForm1::RegisterDevice()
{
TTask::Run([FDeviceID, FDeviceToken, sPlatform]()
{
...
}
);
}
ingalime wrote:2. Why are you using _D instead L?
Because the code is using System::String. Similar to how the _T() and TEXT() macros map a literal to the data type used by the C runtime's _TCHAR and Win32 API's TCHAR data types, respectively, the _D() macro maps a literal to the data type used by the System::String and System::Char data types. Prior to CB2009, that was Ansi 'char'. In CB2009 onwards, that is now UTF-16 'wchar_t' (Windows) and 'char16_t' (other platforms). Who knows what it will be in the future.
ingalime wrote:3. What is the real difference?
On Windows, there is currently no difference, since L"" and _D("") both map to the same 'wchar_t' data type. On other platforms, though, there is a difference, since 'wchar_t' is 32bit instead of 16bit on some platforms. That is why 'char16_t' is used instead on those platforms, to ensure 16bit since System::String is currently UTF-16 on all platforms. L"" does not produce a 16bit literal on those platforms, u"" does. So _D() maps to either L"" or u"" as needed.