大家好
我用vc++做了一个dll 里面有一个 字符串,用来接收网络数据,当接到数据后,如何显示在 c# 的 listbox中呢?

解决方案 »

  1.   

    如果都是vc++的话可以用指针指过去添加,但这个是c#怎么办呢???
      

  2.   

    C#的话,可以使用out string或者StringBuilder去接收哟。
      

  3.   

    举例说明:
    using System.Text;
    using System.Runtime.InteropServices;[DllImport("vc.dll",
     EntryPoint="方法名",
     ExactSpelling=false,
     CallingConvention=CallingConvention.Cdecl)]
    private extern int 方法名(out string 你想要的);
      

  4.   

    你应当没有理解我的意思
    我知道如何接受,是想让他能够及时地显示在listbox中,例如qq 一旦别人给你发了消息,就可以在listbox中显示
      

  5.   

    我用的是dll接收 存储 消息,提供一个函数读出,
      

  6.   

    不好意思,理解错了。ListBox不是也有DataSource吗?使用DataSource,每次收到消息以后加入到数据源DataSource,重新绑定一下可以吗?