Options

blob stream to .net *.dll

chridochrido Member Posts: 12
Hello,

I like to stream out to a .net dll from a blob. Which type is used for this?

I've tried System.Runtime.InteropServices.ComTypes.UnmanagedType.SafeArray, System.IO.Stream, ... but they all didn't work.

In the C/SIDE documentation it is said that they use VT_STREAM, so i tried:
Stream testStream([In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_STREAM)] Stream Items);
But it also didn't work.

Has anybody had similar problems and how did you solve them?

greetings chris

Comments

  • TonyHTonyH Member Posts: 223
    Are you getting an error?

    I know streaming out of Navision the receiver needs to be IStream Persistent.

    T
  • chridochrido Member Posts: 12
    That's the interface:
    Boolean testStream([In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_STREAM)] Stream Items);
    

    If you look in Navision in the C/AL Symbol Menu
    [BOOL testStream :=] testStream(_STREAM Items)

    And this results in this error Message if you try to save:
    Type conversion is not possible because 1 of the operators contains an invalid type
    Automation := OutStream

    So I think _STREAM is incorrect. It should be VARIANT (like msxml.load)

    can you give me a hint?
  • chridochrido Member Posts: 12
    Now I changed the interface once more to:
    Boolean testStream([In, MarshalAs(UnmanagedType.AsAny)] object Items);
    

    And in the Symbol Menu the types seem to fit:
    [BOOL testStream :=] testStream(VARIANT Items)

    So I get the Stream in .net as an object. But what do I do now to get the content? Because it's a Com Type I can't just cast it to a Stream.

    greetings, chris
  • wakestarwakestar Member Posts: 207
    hi chris
    I'm also trying to pass a stream to a .net control. No luck yet. :roll:

    I had the same results.

    let us know when you have some interesting news.
  • wakestarwakestar Member Posts: 207
    MSDN says:

    UCOMIStream Interface

    NOTE: This interface is now obsolete.
    Use IStream instead.
  • wakestarwakestar Member Posts: 207
    YES!!!! \:D/ \:D/ \:D/ \:D/ \:D/
  • chridochrido Member Posts: 12
    =D> =D>
    Thanks!
  • wakestarwakestar Member Posts: 207
    BlackTiger wrote:
    Ok. Posted to "Downloads".

    link? I cannot see the download :-k
  • wakestarwakestar Member Posts: 207
    ah ok :!:

    I have a strange error - message in german.
    something like "error at the requisition of the type System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089."

    :shock:
  • wakestarwakestar Member Posts: 207
    wakestar wrote:
    ah ok :!:

    I have a strange error - message in german.
    something like "error at the requisition of the type System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089."

    :shock:


    Problem solved! Stream is working now!

    @ chrido & BlackTiger: Thanks a million! =D>
  • wakestarwakestar Member Posts: 207
    anyone knows how to send the stream back to navision?

    I'm trying it with passing the stream through an event but no luck yet....

    "The stream is either out of scope or has not been initialized...."
  • chridochrido Member Posts: 12
    I haven't tried it already, but maybe it is possible to pass a XMLDOMNode backto navision? Because it is possible to hand over a Com Class from nav to .net 2.0 like XMLDOMNode. Just call the method with the Com Class as Parameter.

    I have already tried that during the lunch break, but not hard enough.

    Regrettably I have no Windows computer around this weekend, only my freebsd machine, no navision :cry: Currently i feel like a setrange ;)
  • wakestarwakestar Member Posts: 207
    BlackTiger wrote:
    But you have to switch streams.

    you mean in c#, right?
    some sample code would be great!
  • toortoor Member Posts: 52
    Has someone found a solution to pass back a stream to navision yet?

    regards
    tobias
  • SteveOSteveO Member Posts: 164
    You just have to support the IStream.Read method in your COM control.

    The way I have done it in the past is as follows.

    In C# have a method like pubic MyIStream GetStream()

    then in Navision have an InStream variable and do the following

    MyInStream := MyControl.GetStream();
    This isn't a signature, I type this at the bottom of every message
Sign In or Register to comment.