引用一个dll  
Dim telconnobj As New FAXCOMXLib.FaxClientX
Dim telnumobj As New FAXCOMXLib.SendTask
Dim telresultobj As New FAXCOMXLib.ResultTaskdim numOfTasks as longReDim starttime() as string
ReDim faxendtime()as string
ReDim sendjg()as string
ReDim sendid()as stringReDim starttime(numOfTasks)as string
ReDim faxendtime(numOfTasks)as string
ReDim sendjg(numOfTasks)as string
ReDim sendid(numOfTasks)as stringtelconnobj.PickResultTask mCid, telresultobj
'telresultobj是一个自定义结构,是dll函数库中的!'telconnobj.PickResultTask mCid, telresultobj他是调用一个c++的dll函数!for j=0 to numoftasks-1MsgBox telresultobj.starttime'这是调完dll之后,返回的 telresultobj 这个结构中的!
MsgBox telresultobj.EndTime'这是调完dll之后,返回的 telresultobj 这个结构中的!到这,,返回的两个时间是正确的!starttime(j) = telresultobj.starttime
faxendtime(j) = telresultobj.EndTimeMsgBox starttime(j)
MsgBox faxendtime(j)到这,,这两个时间就都变成telresultobj.starttime了!
next 
原本代码中有很多代码,检查到最后,一一删除,就剩这些了,才发现是此问题,请高手帮下兄弟!

解决方案 »

  1.   

    Dim starttime() as string
    Dim faxendtime()as string
    Dim sendjg()as string
    Dim sendid()as string发布的时候粘错了!
      

  2.   

    numOfTasks这个值取出来了,,忘粘上了
      

  3.   

    ======
    MsgBox telresultobj.starttime'这是调完dll之后,返回的 telresultobj 这个结构中的!
    MsgBox telresultobj.EndTime'这是调完dll之后,返回的 telresultobj 这个结构中的!到这,,返回的两个时间是正确的!starttime(j) = telresultobj.starttime
    faxendtime(j) = telresultobj.EndTime
    =======
    在上面這部分代碼中, 你調用了兩次 telresultobj.starttime和telresultobj.EndTime,
    所以第二次取 telresultobj.EndTime剛好 telresultobj.StartTime相同了
    建議你取消這兩行試試
    ==============
    MsgBox telresultobj.starttime'这是调完dll之后,返回的 telresultobj 这个结构中的!
    MsgBox telresultobj.EndTime'这是调完dll之后,返回的 telresultobj 这个结构中的!
    ===========