here is an exemple of program that doesn't work:
(****************************************)
procedure TimeCallBack7(TimerID, Msg:Uint; dwUser, dw1, dw2: DWord); pascal;
var
val : real;
volts : Olevariant;
begin
Form1.CWAIPoint1.SingleRead(volts, 1000);
val := volts ;
Form1.ListBox1.Items.Add(floatTOstr(val));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
fid7:=TimeSetEvent(1000,0,@TimeCallBack7,0,TIME_PERIODIC);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
TimeKillEvent(fid7);
end;
(****************************************)
the procedure TForm1.Button1Click, react when I click on the first button. It begins the acquisition, by Callint TimeSetEvent. The parametres indicates, the rou
tine to call (here TimeCallBack7) and the gap between each call (here 1000 ms).
In the procedure TimeCallBack7, I make a read on my CWAI Point, and display the reslut in a List Box.
And the last procedure TForm1.Button2Click, kill the processus fid7, when button2 is clicked.
This program work perfectly except that it makes an error when I close the window.
The error is :
'Exception EAccessViolation in the modul MFC42.djj at 00001351. Acces Violation at the adress 6c1e1351 of the modul MFC42.dll. Reading at the adress 00000004.'