D
dastone
Unregistered / Unconfirmed
GUEST, unregistred user!
在C中的'PDFENC32.DLL'的定義如下:<br>typedef struct s_pdfobject {<br> uint16 ioType; /* Input/Output */<br> uint16 ioDirection; /* File/Callback/Memory */<br> PDFSIZET nLen; /* (Bytes to encode)/(Bytes written) */<br><br> union {<br> LPMEMBUF lpMemBuffer;<br> struct {<br> LPFNPDFIO lpfnCallback;<br> LPVOID lpAppArg;<br> } func;<br> struct {<br> FILEHANDLE hFile;<br> FILEPOS nInitPos;<br> Bool fMustClose;<br> } file;<br> struct {<br> LPMEMBUF lpMem; /* For CF_TEXT clipboard input */<br> uint16 fmtOutput; /* API definition for output format */<br> } clip;<br> } access;<br> Bool fIsHuge;<br> LPVOID lpState; /* internal state information/buffer */<br><br>} PDFObject;<br>typedef PDFObject FAR *LPPDFObject;<br><br>Bool PDFAPI MakeMemoryObject( LPPDFObject lpObj, uint16 ioDirection, LPVOID lpBase );<br><br>在delphi中的調用定義如下:<br>Type<br> pTPDFObj=^TPDFOBJ ;<br><br> TPDFOBJ =record<br> ioType: Integer; // Input/Output<br> ioDirection: Integer; // File/Callback/Memory<br> nLenouble; // (Bytes to encode)/(Bytes written)<br><br> // Type specific information storage<br> dummy1 ouble;<br> dummy2 ouble;<br> dummy3 ouble;<br> dummy4 ouble;<br> dummy5 ouble;<br><br> dummy6 ouble;<br> dummy7 ouble;<br>end;<br><br>Function MakeMemoryObject(lpObj : pTPDFObj; var ioDirection : Integer; lpBase : Variant) : Integer;stdcall;external 'PDFENC32.DLL' name 'MakeMemoryObject';<br><br>調用:<br>function TForm1.EncodeSourceFile:Boolean;<br>var<br> nErrCode:Integer;<br> ObjInputTPDFObj;<br>begin<br> Result:=True;<br><br> ObjInput:=new(pTPDFObj);<br> try<br> nErrCode:=MakeFileNameObject(ObjInput,PDFINPUT,pChar (SourceFileName));<br> if nErrCode<0 then<br> begin<br> ShowMessage('Encode Error!');<br> Result:=False ;<br> end;<br> finally<br> dispose(ObjInput);<br> end; <br> end;<br>end;<br><br>可是無論怎樣調用都出錯,不知道我的定義對不對,有那位大俠幫忙,不勝感謝!<br>