library ddeunadv;
uses PasMex32,Windows,DDEML,dde_init;
{jede dieser DLLs auf andere Basisadressen relozieren}
{$IMAGEBASE $10060000}
procedure mexFunction(nlhs:LongInt; var plhs:TMatArr;
nrhs:LongInt; const prhs:TMatArr); stdcall;
var
conv: HConv;
items: array[0..MaxAdvItems-1] of Hsz;
i,AdvItems: Integer;
cf: UInt;
timeout: LongInt;
ok,gok: Bool; {Okay und Gesamt-Okay}
{Mehr-als-zwei-dimensionale Matrizen knnen nur mit CF_MatTable
bertragen werden}
begin
TestInputArgs(nrhs,prhs,2,4,$6,$D); {ncbn}
conv:=Round(mxGetScalar(prhs[0]));
AdvItems:=ArrayToStringHandles(prhs[1],@items[0],MaxAdvItems);
cf:=CF_Text;
if nrhs>=3 then CheckClipFormat(prhs[2],cf,nil); {testen & umwandeln}
timeout:=StdTimeOut;
if nrhs=4 then timeout:=Round(mxGetScalar(prhs[3]));
gok:=true;
for i:=0 to AdvItems-1 do begin
ok:=DdeClientTransaction(nil,0,conv,items[i],cf,
XTYP_AdvStop,timeout,nil)<>0;
gok:=gok and ok;
if ok then advDeleteInfo(conv,items[i],cf);
end;
plhs[0]:=mxCreateDoubleMatrix(1,1,mxReal);
mxGetPr(plhs[0])^:=LongInt(gok); {BOOL-Rckgabe}
mxSetLogical(plhs[0]); {neu bei Matlab5}
HandleDdeError(0); {falls etwas schiefging: anzeigen!}
end;
exports
mexFunction;
begin
DisableThreadLibraryCalls(HInstance);
end.
Vorgefundene Kodierung: UTF-8 | 0
|