External dll

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marino

    External dll

    Hi!

    I have a problem in calling a function from an external dll source.
    Prototype for a function is given in vb code

    Declare Function GetMessageData Lib "c:\windows\sys tem\smartdll.dl l" (ByVal
    theLength As Integer, ByRef theMessageLengt h As Integer, ByVal
    theMessageData As String) As Integer

    I would like to call this funcition from c# and I just can't seem to get a
    hang of it...
    Manufacturer description is very scarce...
    Where should I use the string, or do I need StringBuilder, can anyone help?

    Thanks,
    Marino


  • GArlington

    #2
    Re: External dll

    On Jun 10, 8:52 am, "Marino" <mar...@dir.hrw rote:
    Hi!
    >
    I have a problem in calling a function from an external dll source.
    Prototype for a function is given in vb code
    >
    Declare Function GetMessageData Lib "c:\windows\sys tem\smartdll.dl l" (ByVal
    theLength As Integer, ByRef theMessageLengt h As Integer, ByVal
    theMessageData As String) As Integer
    I suspect that your problem comes from "ByRef theMessageLengt h As
    Integer",
    you should call the finction with (theLength, ref theMessageLengt h,
    theMessageData)
    see REF before theMessageLengt h
    >
    I would like to call this funcition from c# and I just can't seem to get a
    hang of it...
    Manufacturer description is very scarce...
    Where should I use the string, or do I need StringBuilder, can anyone help?
    >
    Thanks,
    Marino

    Comment

    • Ignacio Machin ( .NET/ C# MVP )

      #3
      Re: External dll

      On Jun 10, 3:52 am, "Marino" <mar...@dir.hrw rote:
      Hi!
      >
      I have a problem in calling a function from an external dll source.
      Prototype for a function is given in vb code
      >
      Declare Function GetMessageData Lib "c:\windows\sys tem\smartdll.dl l" (ByVal
      theLength As Integer, ByRef theMessageLengt h As Integer, ByVal
      theMessageData As String) As Integer
      >
      I would like to call this funcition from c# and I just can't seem to get a
      hang of it...
      Manufacturer description is very scarce...
      Where should I use the string, or do I need StringBuilder, can anyone help?
      >
      Thanks,
      Marino
      Does the function works in VB?
      Is that VB.NET or VB6?

      What kind of dll is it? Is it a win32 one or a COM dll?

      Comment

      • Marino

        #4
        Re: External dll

        Yes, that seems to be the problem. Thank you!
        Even though that works in some functions, while other have problems.
        I am currently thinking that the problem is within incompatibile types,
        because I am programming in .net while this dll seems to function the best
        in "old" languages...
        Will keep trying...

        "GArlington " <garlington@tis cali.co.ukwrote in message
        news:af4be5c2-46a9-41a2-997a-5fafb52de759@s5 0g2000hsb.googl egroups.com...
        On Jun 10, 8:52 am, "Marino" <mar...@dir.hrw rote:
        >Hi!
        >>
        >I have a problem in calling a function from an external dll source.
        >Prototype for a function is given in vb code
        >>
        >Declare Function GetMessageData Lib "c:\windows\sys tem\smartdll.dl l"
        >(ByVal
        >theLength As Integer, ByRef theMessageLengt h As Integer, ByVal
        >theMessageDa ta As String) As Integer
        I suspect that your problem comes from "ByRef theMessageLengt h As
        Integer",
        you should call the finction with (theLength, ref theMessageLengt h,
        theMessageData)
        see REF before theMessageLengt h
        >>
        >I would like to call this funcition from c# and I just can't seem to get
        >a
        >hang of it...
        >Manufacturer description is very scarce...
        >Where should I use the string, or do I need StringBuilder, can anyone
        >help?
        >>
        >Thanks,
        >Marino
        >

        Comment

        • Ben Voigt [C++ MVP]

          #5
          Re: External dll

          Marino wrote:
          Yes, that seems to be the problem. Thank you!
          Even though that works in some functions, while other have problems.
          I am currently thinking that the problem is within incompatibile
          types, because I am programming in .net while this dll seems to
          function the best in "old" languages...
          Will keep trying...
          VB6 Integer is .NET System.Int16, not the same as C# int (which is
          System.Int32)

          That may be your problem.
          >
          "GArlington " <garlington@tis cali.co.ukwrote in message
          news:af4be5c2-46a9-41a2-997a-5fafb52de759@s5 0g2000hsb.googl egroups.com...
          >On Jun 10, 8:52 am, "Marino" <mar...@dir.hrw rote:
          >>Hi!
          >>>
          >>I have a problem in calling a function from an external dll source.
          >>Prototype for a function is given in vb code
          >>>
          >>Declare Function GetMessageData Lib "c:\windows\sys tem\smartdll.dl l"
          >>(ByVal
          >>theLength As Integer, ByRef theMessageLengt h As Integer, ByVal
          >>theMessageDat a As String) As Integer
          >I suspect that your problem comes from "ByRef theMessageLengt h As
          >Integer",
          >you should call the finction with (theLength, ref theMessageLengt h,
          >theMessageData )
          >see REF before theMessageLengt h
          >>>
          >>I would like to call this funcition from c# and I just can't seem
          >>to get a
          >>hang of it...
          >>Manufacture r description is very scarce...
          >>Where should I use the string, or do I need StringBuilder, can
          >>anyone help?
          >>>
          >>Thanks,
          >>Marino

          Comment

          • Marino

            #6
            Re: External dll

            This solved the problem... Strange dll, it references as though params are
            long, but in some params it only accepts int16, in some int and in some
            long... Very strange..

            Thank you a bunch for your help!!

            "Ben Voigt [C++ MVP]" <rbv@nospam.nos pamwrote in message
            news:Oc62dPAzIH A.2220@TK2MSFTN GP06.phx.gbl...
            Marino wrote:
            >Yes, that seems to be the problem. Thank you!
            >Even though that works in some functions, while other have problems.
            >I am currently thinking that the problem is within incompatibile
            >types, because I am programming in .net while this dll seems to
            >function the best in "old" languages...
            >Will keep trying...
            >
            VB6 Integer is .NET System.Int16, not the same as C# int (which is
            System.Int32)
            >
            That may be your problem.
            >
            >>
            >"GArlington " <garlington@tis cali.co.ukwrote in message
            >news:af4be5c 2-46a9-41a2-997a-5fafb52de759@s5 0g2000hsb.googl egroups.com...
            >>On Jun 10, 8:52 am, "Marino" <mar...@dir.hrw rote:
            >>>Hi!
            >>>>
            >>>I have a problem in calling a function from an external dll source.
            >>>Prototype for a function is given in vb code
            >>>>
            >>>Declare Function GetMessageData Lib "c:\windows\sys tem\smartdll.dl l"
            >>>(ByVal
            >>>theLength As Integer, ByRef theMessageLengt h As Integer, ByVal
            >>>theMessageDa ta As String) As Integer
            >>I suspect that your problem comes from "ByRef theMessageLengt h As
            >>Integer",
            >>you should call the finction with (theLength, ref theMessageLengt h,
            >>theMessageDat a)
            >>see REF before theMessageLengt h
            >>>>
            >>>I would like to call this funcition from c# and I just can't seem
            >>>to get a
            >>>hang of it...
            >>>Manufactur er description is very scarce...
            >>>Where should I use the string, or do I need StringBuilder, can
            >>>anyone help?
            >>>>
            >>>Thanks,
            >>>Marino
            >
            >

            Comment

            • Ben Voigt [C++ MVP]

              #7
              Re: External dll

              Marino wrote:
              This solved the problem... Strange dll, it references as though
              params are long, but in some params it only accepts int16, in some
              int and in some long... Very strange..
              I highly doubt that any of the parameters are a C# long (System.Int64).
              LONG in C++ and Long in VB6 are the same as .NET System.Int32.
              >
              Thank you a bunch for your help!!
              >
              "Ben Voigt [C++ MVP]" <rbv@nospam.nos pamwrote in message
              news:Oc62dPAzIH A.2220@TK2MSFTN GP06.phx.gbl...
              >Marino wrote:
              >>Yes, that seems to be the problem. Thank you!
              >>Even though that works in some functions, while other have problems.
              >>I am currently thinking that the problem is within incompatibile
              >>types, because I am programming in .net while this dll seems to
              >>function the best in "old" languages...
              >>Will keep trying...
              >>
              >VB6 Integer is .NET System.Int16, not the same as C# int (which is
              >System.Int32 )
              >>
              >That may be your problem.
              >>
              >>>
              >>"GArlington " <garlington@tis cali.co.ukwrote in message
              >>news:af4be5 c2-46a9-41a2-997a-5fafb52de759@s5 0g2000hsb.googl egroups.com...
              >>>On Jun 10, 8:52 am, "Marino" <mar...@dir.hrw rote:
              >>>>Hi!
              >>>>>
              >>>>I have a problem in calling a function from an external dll
              >>>>source. Prototype for a function is given in vb code
              >>>>>
              >>>>Declare Function GetMessageData Lib
              >>>>"c:\windows \system\smartdl l.dll" (ByVal
              >>>>theLength As Integer, ByRef theMessageLengt h As Integer, ByVal
              >>>>theMessageD ata As String) As Integer
              >>>I suspect that your problem comes from "ByRef theMessageLengt h As
              >>>Integer",
              >>>you should call the finction with (theLength, ref theMessageLengt h,
              >>>theMessageDa ta)
              >>>see REF before theMessageLengt h
              >>>>>
              >>>>I would like to call this funcition from c# and I just can't seem
              >>>>to get a
              >>>>hang of it...
              >>>>Manufacture r description is very scarce...
              >>>>Where should I use the string, or do I need StringBuilder, can
              >>>>anyone help?
              >>>>>
              >>>>Thanks,
              >>>>Marino

              Comment

              • Marino

                #8
                Re: External dll

                Seems strange to me to, but if I use any other filetype other than long it
                doesn''t work...

                "Ben Voigt [C++ MVP]" <rbv@nospam.nos pamwrote in message
                news:%23JTUiyIz IHA.3680@TK2MSF TNGP05.phx.gbl. ..
                Marino wrote:
                >This solved the problem... Strange dll, it references as though
                >params are long, but in some params it only accepts int16, in some
                >int and in some long... Very strange..
                >
                I highly doubt that any of the parameters are a C# long (System.Int64).
                LONG in C++ and Long in VB6 are the same as .NET System.Int32.
                >
                >>
                >Thank you a bunch for your help!!
                >>
                >"Ben Voigt [C++ MVP]" <rbv@nospam.nos pamwrote in message
                >news:Oc62dPAzI HA.2220@TK2MSFT NGP06.phx.gbl.. .
                >>Marino wrote:
                >>>Yes, that seems to be the problem. Thank you!
                >>>Even though that works in some functions, while other have problems.
                >>>I am currently thinking that the problem is within incompatibile
                >>>types, because I am programming in .net while this dll seems to
                >>>function the best in "old" languages...
                >>>Will keep trying...
                >>>
                >>VB6 Integer is .NET System.Int16, not the same as C# int (which is
                >>System.Int3 2)
                >>>
                >>That may be your problem.
                >>>
                >>>>
                >>>"GArlingto n" <garlington@tis cali.co.ukwrote in message
                >>>news:af4be5c 2-46a9-41a2-997a-5fafb52de759@s5 0g2000hsb.googl egroups.com...
                >>>>On Jun 10, 8:52 am, "Marino" <mar...@dir.hrw rote:
                >>>>>Hi!
                >>>>>>
                >>>>>I have a problem in calling a function from an external dll
                >>>>>source. Prototype for a function is given in vb code
                >>>>>>
                >>>>>Declare Function GetMessageData Lib
                >>>>>"c:\window s\system\smartd ll.dll" (ByVal
                >>>>>theLengt h As Integer, ByRef theMessageLengt h As Integer, ByVal
                >>>>>theMessage Data As String) As Integer
                >>>>I suspect that your problem comes from "ByRef theMessageLengt h As
                >>>>Integer",
                >>>>you should call the finction with (theLength, ref theMessageLengt h,
                >>>>theMessageD ata)
                >>>>see REF before theMessageLengt h
                >>>>>>
                >>>>>I would like to call this funcition from c# and I just can't seem
                >>>>>to get a
                >>>>>hang of it...
                >>>>>Manufactur er description is very scarce...
                >>>>>Where should I use the string, or do I need StringBuilder, can
                >>>>>anyone help?
                >>>>>>
                >>>>>Thanks,
                >>>>>Marino
                >
                >

                Comment

                Working...