具体代码为: 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
[email protected]
纯API多线程只能编译为P代码
最还是用ActiveX dll多线程
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