how to get a pointer to a Stream?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QXNzaWRv?=

    how to get a pointer to a Stream?

    Hello @all,

    can someone tell me how to get a pointer to a stream?
    I need to pass the pointer to an API-Functioncall.

    Thanks for any help!
  • Armin Zingler

    #2
    Re: how to get a pointer to a Stream?

    "Assido" <Assido@discuss ions.microsoft. comschrieb
    Hello @all,
    >
    can someone tell me how to get a pointer to a stream? I need to pass
    the pointer to an API-Functioncall.
    Does the API function know what a .Net IO.Stream is? Haven't had it at
    all yet. Declaring the argument "byval bla as io.stream" and passing "x"
    (x being declared As IO.Stream) would do the job. But I have doubts that
    a stream is a stream.


    Armin

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: how to get a pointer to a Stream?

      "Assido" <Assido@discuss ions.microsoft. comschrieb:
      can someone tell me how to get a pointer to a stream?
      I need to pass the pointer to an API-Functioncall.
      Could you post the API function's prototype?

      If you are referring to the file's handle, take a look at the 'FileStream'
      object's 'Handle' property.

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

      Comment

      • =?Utf-8?B?QXNzaWRv?=

        #4
        Re: how to get a pointer to a Stream?

        Hello Herfried,

        here is the API-Function:

        Declare Function WrapCompressedR TFStream Lib "mapi32.dll " (ByRef
        lpCompressedRTF Stream As Long, ByVal ulFlags As Long, ByRef
        lpUncompressedR TFStream As Long) As Long


        "Herfried K. Wagner [MVP]" wrote:
        "Assido" <Assido@discuss ions.microsoft. comschrieb:
        can someone tell me how to get a pointer to a stream?
        I need to pass the pointer to an API-Functioncall.
        >
        Could you post the API function's prototype?
        >
        If you are referring to the file's handle, take a look at the 'FileStream'
        object's 'Handle' property.
        >
        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
        >
        >

        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: how to get a pointer to a Stream?

          "Assido" <Assido@discuss ions.microsoft. comschrieb:
          here is the API-Function:
          >
          Declare Function WrapCompressedR TFStream Lib "mapi32.dll " (ByRef
          lpCompressedRTF Stream As Long, ByVal ulFlags As Long, ByRef
          lpUncompressedR TFStream As Long) As Long
          You may want to wrap the stream into a
          'System.Runtime .InteropService s.ComTypes.IStr eam' and declare the parameter
          as 'ByVal ... As IStream'. However, note that your declaration is not valid
          for VB.NET.

          Untested:

          \\\
          Imports System.Runtime. InteropServices
          Imports System.Runtime. InteropServices .ComTypes
          ....
          Public Declare Function WrapCompressedR TFStream Lib "mapi32.dll " ( _
          ByVal lpCompressedRTF Stream As IStream, _
          ByVal ulflags As UInt32, _
          <Out()ByVal lpUncompressedR TFStream As IStream _
          ) As IntPtr
          ///

          Maybe you have to specify additional marshalling attributes.

          --
          M S Herfried K. Wagner
          M V P <URL:http://dotnet.mvps.org/>
          V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

          Comment

          Working...