Any questions from a PROFI to a SUPER PROFI - 1. - page 15

 
TheXpert:

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.
It needs to be converted to WORD. It is 2 bytes and INT is 4 bytes. I.e. we will have to put two characters into one INT. High 2 bytes (first) + low 2 bytes (second).
 
Zhunko:
It has to be in WORD, after all. It is 2 bytes and INT is 4 bytes. That is, one INT must contain two characters. High 2 bytes (first) + low 2 bytes (second).
Yes, that's what I meant when I was talking about size accounting.
 

You should try it. Maybe there will be no problems when using MultiByteToWideChar() function directly.

To slip it an INT array. It is by reference anyway. What difference does it make - what type does it have? It is filled not by type but bytes.

Also pass it to WinHttpConnect().

 
Zhunko:

You should try it. Maybe there will be no problems when using MultiByteToWideChar() function directly.

To slip it an INT array. It is by reference anyway. What difference does it make - what type does it have? It is filled not by type but bytes.

Also pass it to WinHttpConnect().

made a check

#import "kernel32.dll"
   int MultiByteToWideChar(int CodePage, int dwFlags,
                           string lpMultiByteStr, int cbMultiByte, int &lpWideCharStr[],int cchWideChar);
#import

int start()
{
        int wbuf[]; string st="1234";
        int n=MultiByteToWideChar (65001, 0, st, -1, wbuf, 0);
        ArrayResize(wbuf, n); MultiByteToWideChar (65001, 0, st, -1, wbuf, n);
        st=""; for (int i=0; i<n; i++) st=st+" "+DoubleToStr(wbuf[i],0); Print("arr="+st);
        st=""; for(i=0; i<ArraySize(wbuf); i++) for(int j=0; j<4; j++) st=st+CharToStr((wbuf[i]>>(j*8))&0xFF); 
        Print("after="+st);
}

I still don't know if MultiByteToWideChar works or not, but it does log the right strings

I also added

#import "ntdll.dll"
   int RtlGetLastWin32Error();
   int RtlSetLastWin32Error(int dwErrCode);
#import 
        hSession=WinHttpOpen("MqlHttp", 0, "", "", 0);
        Print("hSession="+Http.hSession);

        RtlSetLastWin32Error(0); //сбрасываем последний код ошибки
        hConnect=WinHttpConnect(hSession, "www.mql4.com", 80, 0);
        if (hConnect<=0) Print("-Err create Connect "+RtlGetLastWin32Error());
error 12005 - invalid URL
 

Reworked the function description, slipped an array in place of the ServerName string

int WinHttpConnect(int hSession, int& pswzServerName[], int nServerPort, int dwReserved);

But it didn't... Same error.

        RtlSetLastWin32Error(0); //сбрасываем
        int wHost[]; int n=MultiByteToWideChar (65001, 0, "www.mql4.com", -1, wHost, 0);
        ArrayResize(wHost, n); MultiByteToWideChar (65001, 0, "www.mql4.com", -1, wHost, n);
        hConnect=WinHttpConnect(hSession, wHost, 80, 0);
 

Question is not about the MQL4 language. The question is about C++. Many people here know this language. I just need some advice. I did not post my question to the topic of newbies, since people who are new to programming in general often visit it.

Scintilla

I can not find any instructions in Russian on how to install scintilla in Borland C++ Builder 6.0 Enterprise Edition. Search on google did not yield results. I`ve already exhausted my time searching through forums. There is simply no information in Russian. I am not well versed in English at this level. I asked this question on forums of C++ but no answers. Could you please suggest how to accomplish this?
I downloaded the installer from offsite (attached to this post)

Files:
scintilla224.zip  1184 kb
 
drknn:

Question is not about the MQL4 language. The question is about C++. Many people here know this language. I just need some advice. I did not put my question in the newbies thread, since people who are new to programming in general often visit it.

Scintilla

I can not find any instructions in Russian on how to install scintilla in Borland C++ Builder 6.0 Enterprise Edition. Search on google did not yield results. I`ve already exhausted my time searching through forums. There is simply no information in Russian. I am not well versed in English at this level. I asked this question on forums of C++ but no answers. Could you please suggest how to accomplish this?
I downloaded the installer from offsite (attached to this post)

Do you want to embed it as a VCL in the environment? You'll have to write the component by hand, I don't see any other way...
 
sergeev:

Reworked the function description, slipped an array in place of the ServerName string

But it didn't... Same error.

This may be stupid but... Have you tried adding HTTP:// to the URL?
 
alsu:
Do you want to embed it as a VCL in the environment? You'll have to write the component by hand, I don't see any other way...

As far as I understand, I don't need 1 component, but a whole palette of components. I tried embedding a similar SynEdit palette in Borland.Delphi.v7.0. What I don't like is that the text editor's line numbering starts from 01 and not from 1 as it is implemented in Notepad++. Also, could not find a component in SynEdit that allows you to highlight user language syntax. All sorts of C++, pascal, java, php... ...but no custom language. Or maybe there is, but I couldn't find it. So I thought that there's an alternative - skintilla - I've read about it in the Internet. So I googled it for instructions. But there's nothing. On the forums the same thing. However, I've seen people writing about using this or that component from Skintilla. But no one mentions how it got to the palette. It's weird...
 

I need palettes like this