Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Delphi 3.0 + CWAIPoint + TimeSetEvent

Hi,

When I use the CWAIPoint Function, it works perfectly.
When I use the TimeSetEvent/TimeKillEvent function, it works perfectly (this function allow me to call an other function at a regular Time).
But When I include CWAIPoint in the TimeSetEvent call. At the end of the execution, I have an error message : 'Exception EAccesViolation in the module MFC42.dll at 00001351. Acces Violation at the adresse 6C1E1351 of the module MFC42.dll'

I know I have a périodic CW function that can acquire data, but I have a lot stuff to do each time the time activate the function.

Do you know what this error mean? And what is the Solution?
0 Kudos
Message 1 of 4
(4,124 Views)
Dear Mathias,

I have never used Delphi 3.0 but I would try to do my best to understand your question. You say that you include the CWAIPoint in the TimeSetEvent call. Do you mean inside the TimeSetEvent function call? Could you provide a snippet of code that shows how you are calling CWAIPoint inside it?
Also, I don't understand exactly what you mean by "I have a lot of stuff to do each time the time activate the function"... which function is activated? Who activates it?

And finally, why is it necessary to embed the CWAIPoint function inside the TimeSetEvent call?

Azucena Perez
Product Support Engineer
Measurement Studio
0 Kudos
Message 2 of 4
(4,124 Views)
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.'
0 Kudos
Message 3 of 4
(4,124 Views)
Mathias,

As I've been doing some research on Delphi 3.0 with ComponentWorks version 3.0 and earlier, this is what I've found. Delphi 3.0 has some serious problems with ActiveX controls in general, not only National Instruments controls. Furthermore, Delphi 3.0 was released more than 4 years ago, to be exact in April of 97. For this reason, we offer very limited support with old versions of software.
I have found a series of knowledgebase entries that might help you solve this issue. Note that from reading these documents, it seems like upgrading the version of Delphi might save you a lot of headaches in the end. Here is the link with the information I found:

http://search.ni.com/query.html?col=alldocs&ht=0&qp=%2Bcontenttype%3Aknowledgebase+%2Bla
nguage%3Aenglish&lk=1&qs=&layout=KB&qc=&pw=575&ws=0&la=en&qm=0&st=1&lk=1&rf=0&oq=&rq=0&si=0&qt=%2Bdelphi+%2Bdaq+%2Bcomponentworks

Regards,

Azucena Perez
Product Support Engineer
Measurement Studio
0 Kudos
Message 4 of 4
(4,124 Views)