-> Hier kostenlos registrieren
Hallo Forum,
ich bin angehender Elektrotechniker, und schreibe gerade meine Projektarbeit. In dieser Schreibe ich eine Visualisierung die später auf einem Pannel PC unter Windows CE von Beckhoff CP6608-0001 und der SPS CX9000-1001 laufen.
Ich versuch nun schon seit gut einer Woche mittels VB2008 und der TcADSDLL eine Verbindung zur Software SPS von Beckhoff herzustellen.
Um mich in die Programmierung der Visualisierung einzuarbeiten.
Die Beispiele von Beckhoff bringen mich nicht wirklich weiter da diese in VB6 geschreiben sind.
Im Forum habe ich einen Beitrag zu diesem Thema gefunden, aber ich kriege das Programm trotzdem nicht ans laufen.
Ich binde die tcadsdll über Verweise in das Projekt ein.
hier mal der Code den ich bis jetzt geschrieben habe.
Wer kann mir helfen ich sehe den Fehler nicht.
Die SPS ist im Run Modus, und das Programm läuft.
Hoffe auf Hilfe
Gruß
DomHol
ich bin angehender Elektrotechniker, und schreibe gerade meine Projektarbeit. In dieser Schreibe ich eine Visualisierung die später auf einem Pannel PC unter Windows CE von Beckhoff CP6608-0001 und der SPS CX9000-1001 laufen.
Ich versuch nun schon seit gut einer Woche mittels VB2008 und der TcADSDLL eine Verbindung zur Software SPS von Beckhoff herzustellen.
Um mich in die Programmierung der Visualisierung einzuarbeiten.
Die Beispiele von Beckhoff bringen mich nicht wirklich weiter da diese in VB6 geschreiben sind.
Im Forum habe ich einen Beitrag zu diesem Thema gefunden, aber ich kriege das Programm trotzdem nicht ans laufen.
Ich binde die tcadsdll über Verweise in das Projekt ein.
hier mal der Code den ich bis jetzt geschrieben habe.
Code:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
Option[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Explicit[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]On
Imports[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] TcAdsDll
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Form1
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]WithEvents[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ads [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] TcAdsSync
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Declare[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] CopyMemory [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Lib[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"kernel32"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Alias[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"RtlMoveMemory"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] _
([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lpDest [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lpSrc [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Length [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Long[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Form1_Load([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Load
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]On[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Error[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]GoTo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] errFunc
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] client [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] TcAdsDll.TcClient
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] netId [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] AmsNetId
client = CreateObject([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"TcAdsDll.TcClient"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])
netId.b(0) = 0
netId.b(1) = 0
netId.b(2) = 0
netId.b(3) = 0
netId.b(4) = 0
netId.b(5) = 0
ads = client.Connect(netId, 800)
ads.Timeout = 8000
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Exit[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]errFunc:
MsgBox([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Error: (0x"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & Format(Hex(Err.Number), [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"00000000"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"), "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & Err.Description)
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/COLOR][/SIZE]
Wer kann mir helfen ich sehe den Fehler nicht.
Die SPS ist im Run Modus, und das Programm läuft.
Hoffe auf Hilfe
Gruß
DomHol