???请富翁帮我看看,声明和调用的API有错误吗?谢谢啦(100分)

T

tgzhong

Unregistered / Unconfirmed
GUEST, unregistred user!
谁能帮我看看delphi调用api问题,先谢谢了<br><br>API原型定义<br>C format<br>int32 piar_compvaluesfil( <br>int32 pt,<br>int32 PIPTR * count,<br>int32 times[], <br>float rvals[], <br>int32 istats[], <br>char PIPTR * expression, <br>int32 rev, <br>int32 filt );<br><br>Returns<br>&gt;0<br> System error <br>0<br> Success <br>-1<br> Bad point number <br>-101<br> Date not on line <br>-103<br> No data for this point for the passed time <br>-105<br> Bad time and date <br>-121<br> Invalid count parameter <br>-8xx<br> Expression Parsing Error <br>-9xx<br> Network Error <br><br>Arguments<br><br>pt (passed):point number<br>count (passed, returned):Number of values<br>times (passed, returned):Time stamps of values<br>rvals (returned):Values in engineering units<br>istats (returned):Integer or status values<br>expression (passed):Expression string<br>rev (passed):Reverse sequence flag; TRUE to go backwards from times[0], FALSE to go forwards<br>filt (passed):Filter status flag, TRUE to return FilterFailStatus and FALSE to skip values at times when the expression is not satisfied.<br><br>//以下为我接口定义和调用的方式<br><br>//接口单元声明<br>type<br> &nbsp;int32 = Longint;<br> &nbsp;float64 = double;<br> &nbsp;TDynamicInt32Array = array of int32;<br> &nbsp;TDynamicSingleArray = array of Single;<br><br>function piar_compvaluesfil( pt:int32;var count:int32;times:TDynamicInt32Array;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rvals:TDynamicSingleArray; istats:TDynamicInt32Array;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; expression:pChar;rev:int32;filt:int32):int32;stdcall;external 'piapi32.dll';<br><br>//调用<br> var<br> &nbsp; expstr:pchar;<br> &nbsp;i:integer;<br> &nbsp;ret,scount,rev:int32;<br> &nbsp;times,istats:TDynamicInt32Array;<br> &nbsp;rvals:TDynamicSingleArray;<br>begin<br> &nbsp;setLength(times,2000);<br> &nbsp;setLength(istats,2000);<br> &nbsp;setLength(rvals,2000);<br><br> &nbsp;scount :=strtoint(Edit4.Text);<br> &nbsp;times[0] := DateTimetoUnix(StrToDateTime(Edit2.Text));<br> &nbsp;times[scount-1] :=DateTimetoUnix(Now);<br> &nbsp;New(expstr);<br> &nbsp;expstr :='''DCS01GEN900'''+'&gt; 200';<br> &nbsp;Ret:=piar_compvaluesfil(13898,scount,times,rvals,istats,expstr,0,0);<br><br> &nbsp; if Ret = 0 then //此返回值为0正确,但我的返回值-12300。好像是expression不对,但该函数没有该错误信息<br> &nbsp; &nbsp; &nbsp;Memo2.clear;<br> &nbsp; &nbsp; &nbsp;for i:=0 to scount-1 do<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp;Memo2.Lines.Add(inttostr(i)+' || '+datetimetostr(UnixtoDatetime(times))+' || '+formatfloat('0.00',rvals));<br> &nbsp; &nbsp; end;
 
H

happycyp

Unregistered / Unconfirmed
GUEST, unregistred user!
还是你自己快。都没看到问题。
 
顶部