Download MetaTrader 5
To add comments, please log in or register
Your conversation partner speaks foreign language? Automatic translation will help you!
Kashif Javed
824
Kashif Javed 2014.07.10 04:11 

Following code works fine in old builds but not in 600+ builds. In new builds it only passes and get back first letter of the strings. Any one here to tell how to fix this for new builds??

#import "GlobalVariable.dll"
   int GV_SetNamedString(string StrName, string StrValue);
   string GV_GetNamedString(string StrName, string Error);
#import

int init()
{    
 return(0);
}

int deinit()
{    
 return(0);
}

int start()
{                                           
 int SetStr = GV_SetNamedString("abcd", "wxyz");
 string GetStr = GV_GetNamedString("abcd", "ERROR");
 Print("StringGotBack: ", GetStr); 
 return(0);
}
qjol
3243
qjol 2014.07.10 05:06  
in the new build (600 >) strings are unicode
Kashif Javed
824
Kashif Javed 2014.07.10 05:23  
I tried like this but still no success.
#import "GlobalVariable.dll"
   int GV_SetNamedString(uchar & arr1[], uchar & arr2[]);
   string GV_GetNamedString(uchar & arr1[], uchar & arr2[]);
#import

int init()
{    
 return(0);
}

int deinit()
{    
 return(0);
}

int start()
{                                           
 string strname = "abcd";
 string strvalue = "wxyz";
 string err = "ERROR";
 uchar strname1[], strvalue2[], err2[];
 StringToCharArray(strname, strname1);
 StringToCharArray(strvalue, strvalue2);
 StringToCharArray(err, err2);
 int SetStr = GV_SetNamedString(strname1, strvalue2);
 string GetStr = GV_GetNamedString(strname1, err2);
 Print("StringGotBack: ", GetStr); 
 return(0);
}
qjol
3243
qjol 2014.07.10 06:04  

what's the size of those arrays ?

uchar strname1[], strvalue2[], err2[];
qjol
3243
qjol 2014.07.10 06:19  

what about

string GetStr = CharArrayToString(GV_GetNamedString(strname1, err2));


?

or maybe

string GetStr = GV_GetNamedString(CharArrayToString(strname1), CharArrayToString(err2));
Kashif Javed
824
Kashif Javed 2014.07.10 06:27  
qjol:

what about


?

I used code from this post:

https://www.mql5.com/en/forum/149321

Also CharArrayToString is not working.

qjol
3243
qjol 2014.07.10 06:49  
upload your dll (into a zip file) maybe we'll figure out something
Kashif Javed
824
Kashif Javed 2014.07.10 07:17  
here is DLL.
Files:
qjol
3243
qjol 2014.07.10 07:35  
string GetStr = GV_GetNamedString(strname1, err2);
 string value1 = CharArrayToString(strname1);
 string value2 = CharArrayToString(err2);
Kashif Javed
824
Kashif Javed 2014.07.11 03:13  
qjol:


Did you try this? Its not working.
Kashif Javed
824
Kashif Javed 2014.07.17 03:46  
anyone here with solution??
/ /12
To add comments, please log in or register