8. Juni 2007 14:24
public bool SendToNavision([Out, MarshalAs(UnmanagedType.AsAny)] object COMStream, string fileName)
{
IStream COMStream1 = COMStream as IStream;
this.rwBytes = Marshal.AllocHGlobal(4);
int bytes = 0;
byte[] buffer1 = new byte[0xafc8];
FileStream reader = new FileStream(fileName, FileMode.Open);
//IStream COMStream = new IStream();
int _rwBytes = 0xafc8;
bool result = true;
int bytesRead = 0;
do
{
bytesRead = reader.Read(buffer1, 0, _rwBytes);
Marshal.WriteInt32(this.rwBytes, bytesRead);
COMStream1.Write(buffer1, bytesRead, this.rwBytes);
}
while (bytesRead > 0);
//COMStream1.Commit(0);
reader.Close();
reader.Dispose();
Marshal.FreeHGlobal(this.rwBytes);
return result;
}
Rec.INIT;
Rec.INSERT;
Rec.BlobData.CREATEINSTREAM(InStr);
CREATE(StreamTest);
RetVal :=StreamTest.SendToNavision(InStr,'C:\toNAV.xml');
Rec.MODIFY;
XMLPORT.IMPORT(80003, InStr); //Hier ist der InStr schon leer!!!
8. Juni 2007 16:16
Rec.INSERT;
Rec.BlobData.CREATEINSTREAM(InStr);
CREATE(StreamTestAutom);
RetVal := StreamTestAutom.SendToNavision(InStr,'C:\toNAV.xml');
Rec.MODIFY;
Rec.BlobData.CREATEINSTREAM(InStr); //Nochmal ein InStream erzeugen
XMLPORT.IMPORT(80003, InStr); //Und schon geht alles!!
12. Juni 2007 11:32