Dear Rosh: a new question,please help me!!!

 

Dear R;

I know every time I have a new question,you always can give me an answer!thank you!

I have to deal with two MT4 platforms,how to synchronize them without glue EA to each chart?

buy or sell at the same time!

mt4platform1 <-------------- > mt4platform2<-------------->mt4platform3

|

ea ---------------------------------- noea------------------------------ noea

use file?but mql4 cannot operate file outside it's owen directory.

other approach?....

thanks a lot

waitting for your helping.........

GuofuRen.

 

将设备与pc相连,然后将ea对应的文件(*.mq4和*.ex4)传到设备的指导目录上。

或者将设备连到互连网,下载ea对应的文件到设备上。

 

自己编写DLL, 用于它们的通讯(进程间通讯),只是这样的DLL需要计算机专业或半专业水平的人员,不是入门水平的计算机专业人员能做的。

你好像说自己是 计算机软件专业,研究生学历,高级程序员

应该自己能做吧。

 
DxdCn 写道 >>

自己编写DLL, 用于它们的通讯(进程间通讯),只是这样的DLL需要计算机专业或半专业水平的人员,不是入门水平的计算机专业人员能做的。

你好像说自己是 计算机软件专业,研究生学历,高级程序员

应该自己能做吧。

谢谢:

能编,但不想那么费劲。呵呵。

已经解决。

#import "shell32.dll"
int ShellExecuteA(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);
#import

用文件传递信息。

handle=ShellExecuteA(0,"Open","xcopy","\""+源文件路径+"\" \""+目标文件路径+"\" /y","",3);
很简单。

呵呵,多谢!

多交流!

 

用这个也可以

#import "Kernel32.dll"

bool CopyFileA (
string aa,
string bb,
bool cc
);

#import

 

#import "shell32.dll"

是Python、Perl调用win32 api吗?

 

还有更好的主意,只是还没有实现:

就是用环境变量实现。先在系统中设置几个环境变量。如:BUY B 然后

#import "kernel32.dll"
int GetEnvironmentVariableA(string Name, string Buffer, int nSize ) ;
int SetEnvironmentVariableA(string Name, string Value );
#import

SetEnvironmentVariable("BUY", "B" );

只是现在还没有实现;提示错误不知道为什么?

string getbuy;
Print(SetEnvironmentVariableA("BUY", "B"));
Print(GetEnvironmentVariableA("BUY",getbuy,1));
Print(getbuy);

返回值:1 说明操作成功,但为什么环境变量没有改变?

2

0

请高手指点一下,呵呵

 

好像EnvironmentVariable的Set Get是指本进程和本进程创建的子进程的。

其它进程无法得到。

可能 通过设置用户级或机器级的注册表项 可以,并且还需要广播WM_SETTINGCHANGE。 只是注册表操作的C语言也很罗嗦,不比进程间通讯简单到哪里。

 
MSDN中的原话

Calling SetEnvironmentVariable has no effect on the system environment variables.
所以说函数是不会起作用的
解决方案:
To programmatically add or modify system environment variables, add them to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment registry key, then broadcast a WM_SETTINGCHANGE message. This allows applications, such as the shell, to pick up your updates.
可以通过修改注册表来完成

参见:

1) SetEnvironmentVariable 真的可以设置系统变量吗 ?

2) 我希望的我的程序运行时,自动向操作系统的环境变量中写入值

 
I don't have a opportunity to asnswer your questions now. I have a lot of works with new MetaTrader 5. Sorry.
 

谢谢各位:

已实现,谁需要可贡献出来,呵呵!!

发Email.

原因: