唉,换c++吧,我也用vb编过多线程,老非法操作。

解决方案 »

  1.   

    趁早改行吧,VB入门行,往深走,还是C++、JAVA选一个吧
      

  2.   

    能把你的源代码发给我看吗?
    [email protected]
      

  3.   

    这个问题讨论过很多次了
    纯API多线程只能编译为P代码
    最还是用ActiveX dll多线程
      

  4.   

    编译成任何代码都不行,我的目的主要是在处理其他事务时在PictureBox上的游走标语移动时可不受影响。请问大家有没有比较好的办法??
      

  5.   

    具体代码为:
    Public Declare Function timeGetTime Lib "winmm.dll" () As LongPublic Function ShowMovingSlo()
        Dim PosBuf As Integer
        Dim TimeBuf As Long
        
        Dim i As Long, j As Long
        Dim w As Long, k As Long
        
        Dim s() As Byte
        Dim Rst As ADODB.Recordset
        
        Do
            TimeBuf = timeGetTime
        
            If i = 0 Then
                j = j + 1
                Set Rst = leddata.Con.Execute("Select * from XSPSLO Where XSP=" & SelAutoXsp)
                If j > Rst.RecordCount Then j = 1
                
                Set Rst = leddata.Con.Execute("Select * from XSPSLO Where XSP=" & SelAutoXsp & " And NUM=" & j)
                If Rst.EOF Then
                    Sleep 1000
                    GoTo aaa
                End If
                
                s = StrConv(Rst!Slo, vbFromUnicode)
                w = frmMain.SloD.Width + (UBound(s) + 1) * (frmMain.LB.Width \ 2)
                
                k = TextOut(frmMain.SloS.hdc, 0, 0, Rst!Slo, UBound(s) + 1)
                Rst.Close
            End If
        
            i = i + 1
            
            If i > w Then
                i = 0
            Else
                If i <= frmMain.SloD.Width Then
                    k = BitBlt(frmMain.SloD.hdc, frmMain.SloD.Width - i, 0, i, frmMain.SloD.Height, frmMain.SloS.hdc, 0, 0, &HCC0020)
                Else
                    k = BitBlt(frmMain.SloD.hdc, 0, 0, frmMain.SloD.Width, frmMain.SloD.Height, frmMain.SloS.hdc, i - frmMain.SloD.Width, 0, &HCC0020)
                End If
                frmMain.SloD.Refresh
            End If
                
    aaa:
            'Wait some milliseconds...
            Sleep SelSYS.nSD
        Loop
    End Function