MetaTrader 4 Build 574 with Updated MQL4 Language and Market of Applications Released - page 11

[Deleted]  
angevoyageur:
What is difficult with "On File menu, choose Open data folder, and you get your data." ?


hi, i have told problems. i have to manage my files from OS, for many terminals. and i do not like UAC. it produces more dependency, no philosophy.

if you really have to use UAC, user should be able to give dir id names to these data folders, or these dir name must be human readable (matching with original setup dir name, when user see it. not hex code).

so, user can see where he is, from OS explorer, when he is managing files. user can match by one look, instead of searchs.

machine coded hex dir names are not for human. but data dirs for human usage. confilict.

Alain Verleyen
41514
Alain Verleyen  
Ovo:


In the "old" MQL there were a few reasons.

I am talking about the new mql4 of course.

- ill implementation of the file sandbox protection, refusing to accept two dots in the file name (I use a broker that has those dots in a symbol name),

Is this still true with the new version ?

- file write sharing that could not be switched off (fixed in the MQL+)

- data exchange among EAs, when I need access outside the sandbox

You have a COMMON folder for that now. See FILE_COMMON.

- building scripts, that need access to the source folder (yes, I use MQL scripts to support build)

I don't understand this point.

- installing support files (mostly libraries), which are embedded in the script (no longer possible with MQL+, as it does not allow lazy library fetching)

I don't understand this point either. Can you explain please ?
Alain Verleyen
41514
Alain Verleyen  
cbalta:


hi, i have told problems. i have to manage my files from OS, for many terminals. and i do not like UAC. it produces more dependency, no philosophy.

if you really have to use UAC, user should be able to give dir id names to these data folders, or these dir name must be human readable (matching with original setup dir name, when user see it. not hex code).

so, user can see where he is, from OS explorer, when he is managing files. user can match by one look, instead of searchs.

machine coded hex dir names are not for human. but data dirs for human usage. confilict.


Ok I see.

This has been discussed a lot in Russian forum, and you can be sure that current behavior will not be changed. What I am doing is to create shortcuts in the Favorites of Windows Explorer (I can explain more if needed).

[Deleted]  
Ovo:

It cannot work, it uses ansi strings and string arrays. This dll is a dead end with the MQL+.

Nevertheless it should work with ex4 in compatibility mode, just be careful where you place the dll - use the original location (experts/libraries), rather than MQL4/libraries.


The win API is based on C and so is mql4.5. In C a string is a char array with a terminating null char. So it is possible to use ANSI strings in dlls if one writes ones own string functions.

Using ANSI strings in dll function calls in mql4.5:

#property version   "1.00"
#property description "Testing using strings in a funtion call to a dll"
#property strict
#property indicator_chart_window

// Win32 API
#import "Kernel32.dll"
  int GetFileAttributesA(uchar& lpFileName[]);
#import

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit() {
  return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[],
                const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) {
  string sResult="";
  
  if (FileExists(TerminalPath()+"\\MQL4\\indicators\\ZigZag.ex4")==True)
    sResult=TerminalPath()+"\\MQL4\\indicators\\ZigZag.ex4 exists.\n";
  else 
    sResult=TerminalPath()+"\\MQL4\\indicators\\ZigZag.ex4 does not exist.\n";
    
  if (FileExists(TerminalPath()+"\\MQL4\\indicators\\notafile.txt")==True)
    sResult=sResult+TerminalPath()+"\\MQL4\\indicators\\notafile.txt exists.\n";
  else 
    sResult=sResult+TerminalPath()+"\\MQL4\\indicators\\notafile.txt does not exist.\n";
  
  Comment(sResult);
  
  return(rates_total);
}

//-----------------------------------------------------------------------------
// function: FileExists()
// Description: Check if a file exists
//-----------------------------------------------------------------------------
bool FileExists(string sFileName) {
  char szFileName[255];
  
  StrCpy(sFileName,szFileName,sizeof(szFileName));
  if (GetFileAttributesA(szFileName)==-1) {
    return(False);    
  }
  return(True);
}


//-----------------------------------------------------------------------------
// function: StrCpy()
// Description: Copy string to null terminated char array 
//              (for dll string parameter in mql4.5)
//-----------------------------------------------------------------------------
int StrCpy(string sSrc, uchar& szDest[], int iMaxSize) {
  int i;

  for (i=0; i<MathMin(StringLen(sSrc),iMaxSize-1); i++) {
    szDest[i]=(uchar)StringGetChar(sSrc,i);
  }
  if (iMaxSize>0)
    szDest[i]=0;
  return(i);
}

Ex Ovo Omnia
3082
Ex Ovo Omnia  
xaphod:

The win API is based on C and so is mql5. In C a string is a char array with a terminating null char. So one can use ANSI strings in dlls if one writes ones own string functions.

Proof of concept. Using ANSI strings in fll function calls in mql4.5:


It makes no difference that you cannot use the above mentioned DLL. Unless you have any construction for the ansi string arrays as well. And ansi string as returning value.
Alain Verleyen
41514
Alain Verleyen  
xaphod:

The win API is based on C and so is mql4.5. In C a string is a char array with a terminating null char. So it is possible to use ANSI strings in dlls if one writes ones own string functions.

Using ANSI strings in dll function calls in mql4.5:

Your StrCpy() function is re-creating the already existing function StringToCharArray().

StringToCharArray(sFileName,szFileName,0,sizeof(szFileName));
[Deleted]  
angevoyageur:

Your StrCpy() function is re-creating the already existing function StringToCharArray().


Ah! Thanks. That makes it even easier.
Ex Ovo Omnia
3082
Ex Ovo Omnia  
angevoyageur:
I am talking about the new mql4 of course.

Is this still true with the new version ?
You have a COMMON folder for that now. See FILE_COMMON.
I don't understand this point.

I don't understand this point either. Can you explain please ?

Build definition is here. I use ANT as a basic tool, but the MQL was very easy for handling files, even if it needed the winapi. So I have been using it for encryption (I encrypt strings because I want to make it hard for guys who "educate" stolen software), and I use it to embed entire files, like sounds and libraries, into the master script (to make it easier to people that do not understand software installation).

I noticed there was something called FILE_COMMON, so it is very positive.

Well, I do not know if the previous bugs are still present, but I suppose they completely replaced the file handling. So I will learn that later, I am not a tester, just a user :)

[Deleted]  
angevoyageur:

Ok I see.

This has been discussed a lot in Russian forum, and you can be sure that current behavior will not be changed. What I am doing is to create shortcuts in the Favorites of Windows Explorer (I can explain more if needed).


you make upgrade harder. let's see what will happen, with 2nd hardening.

current fault: /portable option is ill. it must be in the front, as an option of setup. (or an option in the MT4 terminal), instead of an external parameter.

i'll use only /portable mode, terminal in one packed dir. without extanal dir dependency.

vista (and uac) engineers make MS lose many years..

Alain Verleyen
41514
Alain Verleyen  
cbalta:

you make upgrade harder. let's see what will happen, with 2nd hardening.

current fault: /portable option is ill. it must be in the front, as an option of setup. (or an option in the MT4 terminal), instead of an external parameter.


I don't make anything harder, I am only a moderator.