Looked at WinHttpConnect(). It has no implementation for multibyte encoding.
Can I use a DLL to shell and convert it?
No. I don't need it in a DLL. I know it's an option, but it's wrong...
wininet.dll, for example, all its functions work, but Winhttp has such a silly bug...
If you could call GetLastError from Kernel32, but mql4 is harmful and does not allow to make functions with identical names, even with different parameters...
By the way, have you tried to run this script on your machine? maybe it's just my problem ?
I understand that it's an option, but it's not the same...
For example, all its functions work with wininet.dll, but in Winhttp there is such a silly stall...
If you could call GetLastError from Kernel32, but mql4 is harmful and does not allow to make functions with identical names, even with different parameters...
By the way, have you tried to run this script on your machine? maybe it's just my problem ?
What if you insert an intermediate dll between GetLastError_2 and Kernel32? Wouldn't that work?
I understand that it's an option, but it doesn't work that way.
wininet.dll, for example, all its functions work, but Winhttp has such a stupid stoppage...
If you could call GetLastError from Kernel32, but mql4 is harmful and does not allow to make functions with identical names, even with different parameters...
If I have time, I'll try to make an example. Otherwise... This C++ code should be converted to MQL4:
The wstring needs to be replaced with an array of ints and take that into account when recalculating the size.
I've got it like this:
inlinestd::wstring AnsiToUnicode(conststd::string &sSourceA, // Строка для преобразования.constint nCodePage) // Кодовая страница может быть одним из значений:// CP_ACP Системное умолчание Windows кодовых страниц ANSI.// CP_OEMCP Нынешняя система OEM кода страницы.// CP_MACCP Нынешняя система Macintosh код страницы.// CP_SYMBOL Символ кода страницы (42).// CP_THREAD_ACP Код Windows ANSI страницы для текущего потока. // CP_UTF7 UTF-7. Используйте это значение только тогда, когда вынужден от транспортного механизма 7-бит. Использование UTF-8 является предпочтительным.
{ // CP_UTF8 UTF-8.int nLength = 0;
std::wstring sStringW = L"";
if (sSourceA.size() == 0) return(sStringW);
if ((nLength = ::MultiByteToWideChar(nCodePage, 0, sSourceA.c_str(), -1, NULL, 0)) == 0) throw(_T("Ошибка в функции \"Utils::StringSTL::AnsiToUnicode()\". В строке отсутствуют символы."));
sStringW.resize(nLength - 1);
if ((nLength = ::MultiByteToWideChar(nCodePage, 0, sSourceA.c_str(), -1, LPWSTR(sStringW.c_str()), nLength)) == 0) throw(_T("Ошибка в функции \"Utils::StringSTL::AnsiToUnicode()\". Строка не преобразована."));
return(sStringW);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Looked at WinHttpConnect(). It has no implementation for multibyte encoding.
Can I use a DLL to shell and convert it?
No. I don't need it in a DLL. I know it's an option, but it's wrong...
wininet.dll, for example, all its functions work, but Winhttp has such a silly bug...
If you could call GetLastError from Kernel32, but mql4 is harmful and does not allow to make functions with identical names, even with different parameters...
By the way, have you tried to run this script on your machine? maybe it's just my problem ?
I understand that it's an option, but it's not the same...
For example, all its functions work with wininet.dll, but in Winhttp there is such a silly stall...
If you could call GetLastError from Kernel32, but mql4 is harmful and does not allow to make functions with identical names, even with different parameters...
By the way, have you tried to run this script on your machine? maybe it's just my problem ?
I understand that it's an option, but it doesn't work that way.
wininet.dll, for example, all its functions work, but Winhttp has such a stupid stoppage...
If you could call GetLastError from Kernel32, but mql4 is harmful and does not allow to make functions with identical names, even with different parameters...
GetLastError() should be called low-level --> RtlGetLastWin32Error(). Ilnur suggested it in his time. Here are some examples of how to use it.
WinHttpConnect() will not work in MQL4.
Nothing will work with WinHttpConnect() in MQL4.
You could try converting.
If I have time, I'll try to make an example. Otherwise... This C++ code should be converted to MQL4:
wstring should be replaced with an array of ints and this should be taken into account when recalculating the size.You could try converting.
If I have time, I'll try to make an example. Otherwise... This C++ code should be converted to MQL4:
The wstring needs to be replaced with an array of ints and take that into account when recalculating the size.I've got it like this:
I have this:
EMNIP, the standard does not guarantee the location of the string in a continuous block of memory, so using the &sStringW[0] construct is fraught.
Basically the same eggs. But mine is 100% according to standard :)
EMP, the standard does not guarantee string location in a contiguous memory block, so using &sStringW[0] construct is fraught with danger.
Same eggs in general. But mine is 100% according to standard :)
I didn't know...
Well, it seems that all (probably all) of Microsoft's implementations are OK with this, I can't vouch for the others.