Navision and Delphi automation streams

Hi I’m have made a OLE automation object in Delphi 7 which I’m using in Navision. The first version of the have this method: function Resize(const inputFileName, outputFileName: WideString; height, width: Integer): Integer; safecall; This works fine when used both in a Delphi program and in Navision. What the function does is to load a picture file from disk and write it out to disk in .bmp format, although this is not really important to know. As I said this works just fine in Navision, where I can load the .bmp file into a BLOB field in a record so that it can be shown on a form in a PictureBox. All is well. Now here is the problem: Instead of writing the bitmap to disk I want to stream the bitmap image back to the calling program to avoid creating a file on the disk. I can get the streaming to work just fine when it’s a Delphi program that calls the automation object, but I just can’t get it to work when I try to receive the stream in Navision. I have tried making the methods in different ways: Way 1, the output stream is one of the parameters: function ResizeToStreamOld(const inputFileName: WideString; out outputStream: IUnknown; height, width: Integer): Integer; safecall; Way 2, the output stream is the function result: function ResizeToStream(const inputFileName: WideString; height, width: Integer; out resultCode: Integer): IUnknown; safecall; Both of these ways work just fine in a Delphi test program. But I can’t get it to work in Navision. Perhaps because I’m rather new at Navision and don’t really know how to work streams in Navision. Does anyone have any experience with streams in Navision and know how to receive a stream so that it can be put into a BLOB field in a record? Is Delphi’s COM streaming and Navision streams compatible? Should it be coded in a specific way in Delphi and Navision in order to work between different languages? I would be thankful for any coding samples you might have that shows how to work with streams between Navision and other languages. I have searched the web but can’t find any examples that apply to this, so any examples that shows how it should be coded in Navision and in the automation object is appreciated. Thanks in advance.

I’m working a lot with streams and found out that the easiest way to stream is the use of the Navision ComCom and SBA. Basically establish a TCP Connection and send over a network stream.

Thanks, but I don’t know what ComCom and SBA is. Can you explain it further? But still, Navision has InStream and OutStream. I thought these could be used, but how to do it? Surely, it must be possible to use streams in Navision, isn’t it?

I do not think that the streams Navision is using are compatible with the ComStreams from Delphi. Please have a look at the Navision SDK( located at the installation CD) and in there into the devguide.chm. There you find quite some examples on how to use the Navision Communication Componenet Automation server and the Bus adapters like Socket Bus Adapter (SBA), Named Pipe Bus Adapter (NPBA) and Microsoft Message Queue Bus Adapter (MSMQBA). I’m pretty sure that you will find a way around your problem. By the way, do you get any error messages or is the stream you are returning just empty ?


im new to navision, i already tried to get table data from navision to Microsoft Excel using C/ODBC connection. But i am unable to use this (C/ODBC) in Im supposed to present required data in grid view but, i cant see my C/ODBC or my database name anywhere. So, can you please help in connecting navision to I have an urgent related works to do. so, Can u please look into my matter as early as possible.