已知COM接口参数是BSTR的,我在VB中用string直接传总是不行,请问究竟该怎样做?

解决方案 »

  1.   

    http://www.softhouse.com.cn/html/200409/2004092414464100000841.html
      

  2.   

    怎么可能?你接口方法没有写对吧!
    eg:
    HRESULT SetStr([in]BSTR str);
    看看测试用例的的一个代码
    Private Sub OpenDem_Click()
    CCZJ3DEvolve1.SetDemFile "D:\ji\演化\TEST\start.GRD"
    还有:
    CommonDialog1.ShowOpen
        Dim filename As String
        filename = CommonDialog1.filename
        SPace61.OpenDem (filename)     '记这这里要加上()  hoho!以前也郁闷过这个问题!祝你幸运!过个好年!好久没有帮助人了!hoho!