Страница: 1 |
|
Вопрос: Как запустить прогу VB6 под WIN7
|
Добавлено: 12.01.12 15:00
|
|
Автор вопроса: denizko
|
Всем здравствуйте! У меня такая проблема. При запуске программы, написанной на VB6, выходит ошибка "Run-Time error 429, ActiveX component can't create object"
Сам я не программист и программа не моя, но чтото понимаю, исходники программы есть. Суть программы в том что она соединяется с OPC сервером на удаленной машине и получает данные оттуда.
Текущие значение через OPC DA она получает без проблем, а вот взять часовые или суточные через OPC HDA выходит эта ошибка. Ошибка ссылается на этот код в программе
Server_HDA.Connect "Logika.SpserverOPC.Hda", "192.168.104.2"
Прошу вас всех помочь мне, как решить эту проблему. В инете прочитал про возможные способы решения проблемы ошибки 429, но ничего не помогло.
Вот весь код программы
Option Explicit
Public Event DataReceiveComplete()
Dim Server_DA As OPCServer
Dim WithEvents Group_DA As OPCGroup
Ответить
|
Номер ответа: 1 Автор ответа: denizko
Вопросов: 1 Ответов: 3
|
Профиль | | #1
|
Добавлено: 12.01.12 15:01
|
Вот весь код программы
Option Explicit
Public Event DataReceiveComplete()
Dim Server_DA As OPCServer
Dim WithEvents Group_DA As OPCGroup
Dim ServerHandles_DA() As Long
Dim Server_HDA As GBHDAAutomation.OPCHDAServer
Dim WithEvents Items_HDA As GBHDAAutomation.OPCHDAItems
Dim ServerHandles_HDA() As Long
Dim Errors() As Long
Dim WorkDate As Date
Private Sub Form_Load()
With msgArchive
.ColWidth(0) = 1000
.ColWidth(1) = 1500
.ColWidth(2) = 1000
.ColWidth(3) = 1500
.ColAlignment(0) = flexAlignCenterCenter
.ColAlignment(1) = flexAlignRightCenter
.ColAlignment(2) = flexAlignCenterCenter
.ColAlignment(3) = flexAlignRightCenter
End With
End Sub
Private Sub Disconnect_DA()
Server_DA.OPCGroups.RemoveAll
Server_DA.Disconnect
Set Group_DA = Nothing
Set Server_DA = Nothing
Erase ServerHandles_DA
End Sub
Private Sub Disconnect_HDA()
Items_HDA.RemoveAll
Server_HDA.Disconnect
Set Items_HDA = Nothing
Set Server_HDA = Nothing
Erase ServerHandles_HDA
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Not Server_DA Is Nothing Then
 isconnect_DA
End If
If Not Server_HDA Is Nothing Then
 isconnect_HDA
End If
End Sub
Sub Fetch(ByVal dt As Date)
WorkDate = dt
'DA
 im ItemIDs_DA(1 To 1) As String
 im ClientHandles_DA(1 To 1) As Long
Set Server_DA = New OPCServer
Server_DA.Connect "Logika.SpserverOPC.Da", "192.168.104.2"
Server_DA.OPCGroups.DefaultGroupIsActive = False
Set Group_DA = Server_DA.OPCGroups.Add("JBZ"
Group_DA.IsSubscribed = True
ItemIDs_DA(1) = "Intra:ЖБЗ:т1:154[P]"
ClientHandles_DA(1) = 1
Group_DA.OPCItems.AddItems 1, ItemIDs_DA, ClientHandles_DA, ServerHandles_DA, Errors
Erase Errors
 im CancelID As Long
Group_DA.AsyncRead 1, ServerHandles_DA, Errors, 0, CancelID
Erase Errors
'HDA
 im ItemIDs_HDA(1 To 1) As String
 im ClientHandles_HDA(1 To 1) As Long
Set Server_HDA = New GBHDAAutomation.OPCHDAServer
Server_HDA.Connect "Logika.SpserverOPC.Hda", "192.168.104.2"
Set Items_HDA = Server_HDA.OPCHDAItems
ItemIDs_HDA(1) = "Intra:ЖБЗ:т1:210[M(т)]"
ClientHandles_HDA(1) = 1
Items_HDA.AddItems 1, ItemIDs_HDA, ClientHandles_HDA, ServerHandles_HDA, Errors
Erase Errors
End Sub
Private Sub Group_DA_AsyncReadComplete(ByVal TransactionID As Long, ByVal NumItems As Long, ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date, Errors_DA() As Long)
If TransactionID = 0 Then
 im CancelID As Long
 im StartTime As Variant
 im EndTime As Variant
StartTime = WorkDate + TimeSerial(1, 0, 0)
EndTime = WorkDate + 1
CancelID = Items_HDA.AsyncReadRaw(1, StartTime, EndTime, 0, True, 1, ServerHandles_HDA, Errors)
Erase Errors
End If
 isconnect_DA
End Sub
Private Sub Items_HDA_AsyncReadComplete(ByVal TransactionID As Long, ByVal Status As Long, ByVal NumItems As Long, ClientHandles() As Long, Aggregates() As Long, ItemValues() As Variant, Errors_HDA() As Long)
 im History As GBHDAAutomation.OPCHDAHistory
 im Value As GBHDAAutomation.OPCHDAValue
 im i As Long, ii As Long
 im r As Long, c As Long
 im dblTotal As Double
Set History = ItemValues(1)
With msgArchive
.Clear
.TextArray(0) = "Время"
.TextArray(1) = "Расход"
.TextArray(2) = "Время"
.TextArray(3) = "Расход"
r = History.Count
If r < 13 Then
.Width = 2500
Else
.Width = 5000
End If
ii = 0
For i = 1 To History.Count
Set Value = History.Item(i)
r = ii Mod 12 + 1
c = (ii \ 12) * 2
.TextMatrix(r, c) = Format(CDate(Value.TimeStamp), "hh:mm"
.TextMatrix(r, c + 1) = CStr(Format(Value.DataValue, "###0.0")
dblTotal = dblTotal + Value.DataValue
ii = ii + 1
Next
End With
lblTotal.Caption = "Итого: " & Str(dblTotal) & " т"
 isconnect_HDA
lblTitle.Caption = "Расход за " & LCase(Format$(WorkDate, "dd mmmm")
RaiseEvent DataReceiveComplete
End Sub
Ответить
|
Страница: 1 |
Поиск по форуму