Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. String

String

Scheduled Pinned Locked Moved Visual Basic
c++helpquestion
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi All. I´ve create a dual interface in VC++ with this method "void SegundoError([out] BSTR my_string)" in the events interface and with its corresponding Fire in the CProxi class. In VB I´ve capture this event: "MiInterface.SegundoError(ByVal string_from_VC As String" and the problem is that "string_from_VC" arrives empty. Cuold tell me someone what I´m doing wrong? Thanks:rose:

    L M 3 Replies Last reply
    0
    • L Lost User

      Hi All. I´ve create a dual interface in VC++ with this method "void SegundoError([out] BSTR my_string)" in the events interface and with its corresponding Fire in the CProxi class. In VB I´ve capture this event: "MiInterface.SegundoError(ByVal string_from_VC As String" and the problem is that "string_from_VC" arrives empty. Cuold tell me someone what I´m doing wrong? Thanks:rose:

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Why did you define your string as [out]? Who is providing the string VB or VC? * if your string is defined in VB and you want to view it in VC, use [in] * if your string is returned to VB, then you should use [out] BSTR * pbstrOut Can you give me more details, please! Did you create your VC++ object using ATL? How do you create an instance inside VB? What is the code that you have in your VC++ function? You should realize that BSTRs are not like LPTSTR or TCHAR * so, inside your SegundoError: SegundoError(BSTR my_string) { USESCONVERSION; LPCTSTR psz = W2T(my_string); printf("String is : %s", psz); } Mh2!:)

      1 Reply Last reply
      0
      • L Lost User

        Hi All. I´ve create a dual interface in VC++ with this method "void SegundoError([out] BSTR my_string)" in the events interface and with its corresponding Fire in the CProxi class. In VB I´ve capture this event: "MiInterface.SegundoError(ByVal string_from_VC As String" and the problem is that "string_from_VC" arrives empty. Cuold tell me someone what I´m doing wrong? Thanks:rose:

        M Offline
        M Offline
        Michael P Butler
        wrote on last edited by
        #3

        If you are trying to pass a string out from VC to VB using a connection point, the IDL should be [in]BSTR my_string Michael :-)

        1 Reply Last reply
        0
        • L Lost User

          Hi All. I´ve create a dual interface in VC++ with this method "void SegundoError([out] BSTR my_string)" in the events interface and with its corresponding Fire in the CProxi class. In VB I´ve capture this event: "MiInterface.SegundoError(ByVal string_from_VC As String" and the problem is that "string_from_VC" arrives empty. Cuold tell me someone what I´m doing wrong? Thanks:rose:

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Your method is "void SegundoError([out] BSTR my_string)" [out] parameters must always be pointers, so your method should be method: "void SegundoError([out] BSTR *my_string)" Hope it helps! ;)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups