MQL4 - automated forex trading   /  

Forum

how to make a timer in dll use delphi ?

Back to topics list To post a new topic, please log in or register

avatar
108
YALEWANG 2010.07.24 22:25 

i want to make a dll,it works independently from its caller .

it is triggered by a Timer,there should be a procedure that do something and get an initial data.

there should be a function and calculate the data and export the result .

my thoughts as follow, but the code does not work,will someone like to help me to modify it ? thanks

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

library dlltest;

uses
SysUtils, windows, Classes;
var
x,y,z,TimeID:integer;
{$R *.res}

procedure aaaa();//////////////////////////////get inial data
begin
x:=random(100);
y:=random(30);
end;


procedure TimerProc(hWn:HWND;nMsg:integer;nTimerid:DWORD;dwTime:DWORD);stdcall;

begin
aaaa();

function add():integer;stdcall;
begin
z:=x+y;
result:= z;
end;

end;
exports
add();

begin

TimeID:=settimer(0,1,2000,@TimerProc);
KillTimer(0, TimeID);
end.

How to Enrich Information You Present? Use Videos!

How to Enrich Information You Present? Use Videos!

How to get more information over to the viewers? There is a very simple method to prepare a video to be published on the MQL4.community website using new technologies.


avatar
426
Ruptor 2010.07.25 14:27 

Hi YW

I don't fully understand what you are after but I would suggest using Lazarus with free Pascal because more people will be able to help you. The guy 7Bit on this site has written a post on another site about how to use Lazarus with MT4 to create DLLs (search here for Lazarus) and in FPC under sysutils there are time functions to do what you require.


avatar
108
YALEWANG 2010.07.25 15:14 

hi, i do not hear you for more then half a year .

i


avatar
108
YALEWANG 2010.07.27 07:34 
Ruptor:

Hi YW

I don't fully understand what you are after but I would suggest using Lazarus with free Pascal because more people will be able to help you. The guy 7Bit on this site has written a post on another site about how to use Lazarus with MT4 to create DLLs (search here for Lazarus) and in FPC under sysutils there are time functions to do what you require.


hi ruptor

i have downloaded FPC lazarus,but i can not add timer or Idletimer to dll codes,though there are in system panel .

can you help me and give an exmple ?


avatar
426
Ruptor 2010.07.27 13:53 

Hi YW

I am new to Lazarus and have not used timers yet. I think the icons are for use in programs that use forms but DLLs don't have forms. You could start a prog with a form and pinch the bit of code for your DLL that sets the timer. Also look at the RTLs & FCLs in the on line help there is timer stuff under FCL, fptimers with examples. For DLLs in MT4 see 7Bit post of examples here

http://www.forexfactory.com/showthread.php?t=219576
Back to topics list  

To add comments, please log in or register