🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #17451

[VB/A] aanroepen van een functie

#17451
From: Dieter Tack
Date: Thu, 16 Dec 1999 00:00
107 lines
3705 bytes
Voor mijn eindwerk moet ik een client schrijven voor een OPCserver (OPC: Ole
for Process Control). Ik heb echter een probleem:

Bij het aanroepen van onderstaande functie (uit dll)  geeft de compiler
(visual basic for applications) fout 13 - Typen komen niet overeen...

dank bij voorbaat,
Dieter Tack


om mij te emailen : verwijder NO SPAM

Sub Add(NumItems As Long, ItemIDs() As String, ClientHandles() As Long,
ServerHandles() As Long, Errors() As Long, [RequestedDataTypes],
[AccessPaths])
    Lid van OPCAutomation.OPCItems



mijn programma:
Private anOPCServer As Opcserver
Private Browser As OPCBrowser
Dim test As Variant

Dim theGroups As OPCGroups
Dim aGroup As OPCGroup
Dim theItems As OPCItems
Dim anItem As OPCItem

Public aiItemIDs(MAX_ITEM) As String           ' [IN] Variables for methodes
Public aiActive(MAX_ITEM) As Boolean
Public aiClientHandles(MAX_ITEM) As Long
Public aiServerHandles(MAX_ITEM) As Long
Public aiServerErrors(MAX_ITEM) As Long
Public aiRequestedDataTypes(MAX_ITEM) As Integer
Public aiValues(MAX_ITEM) As Variant

Public numberOfItems As Long
Public getOPCServerName As String

Public Sub Main()
Set anOPCServer = New Opcserver
anOPCServer.Connect "OPC.Interbus.1") 'Connect to "OPC.Interbus.1"-server
Set theGroups = anOPCServer.OPCGroups
theGroups.Add (Name)          'Make new private group
Set aGroup = theGroups.item(1)
Set theItems = aGroup.OPCItems

Call theItems.Add(numberOfItems, aiItemIDs, aiClientHandles,
aiServerHandles, aiServerErrors) 'hier heeft de compiler een fout !!!!

'alles opruimen

anOPCServer.OPCGroups.RemoveAll 'Remove all groups
Set theItems = Nothing
Set aGroup = Nothing
Set theGroups = Nothing
Set Browser = Nothing
anOPCServer.Disconnect 'Disconnect from OPCServer
End Sub


End Sub

Private Sub GetObjects()
Dim object As Variant
Dim X As Integer
On Error GoTo Show_Error
Set Browser = anOPCServer.CreateBrowser
Tree (0)
Show_Error:
End Sub

Private Sub Tree(root As Integer, Optional Previous As String)
Dim I As Integer
Dim item As Variant
Dim treeNames(MAX_ITEM / 10) As String
Dim itemName As String
Browser.ShowBranches
I = 1
For Each item In Browser
    treeNames(I) = item
    I = I + 1
Next

For I = 1 To Browser.Count
    Browser.ShowBranches
    Browser.MoveDown (Browser.item(I))

    Call Tree(root + 1, Previous + treeNames(I) + "\")
Next I
Browser.ShowLeafs
For Each item In Browser
    If numberOfItems = MAX_ITEM Then
        Exit For
    End If
    itemName = Previous + item
    aiItemIDs(numberOfItems) = CStr(itemName)           'store item name
    aiActive(numberOfItems) = True                      'item state active
    aiClientHandles(numberOfItems) = numberOfItems + 1  'the handle is free
to choose
    aiRequestedDataTypes(numberOfItems) = vbEmpty       'requested type =
canonical type
    numberOfItems = numberOfItems + 1
Next
If root <> 0 Then Browser.MoveUp
End Sub
Technical Details
Message-ID: <83aglg$kft$1@newnews2.news.nl.uu.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 107324,62078d6f0ca9b867,start
X-Google-Attributes: gid107324,public
X-Google-Thread: fcea4,62078d6f0ca9b867,start
X-Google-Attributes: gidfcea4,public
From: "Dieter Tack" <dietertackNO@SPAMhotmail.com>
Subject: [VB/A] aanroepen van een functie
Date: 1999/12/16
Message-ID: <83aglg$kft$1@newnews2.news.nl.uu.net>
X-Deja-AN: 561444646
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-Complaints-To: abuse@nl.uu.net
X-Trace: newnews2.news.nl.uu.net 945341936 20989 194.7.1.25 (16 Dec 1999 10:58:56 GMT)
Organization: UUNET-NL (http://www.nl.uu.net)
NNTP-Posting-Date: 16 Dec 1999 10:58:56 GMT
Newsgroups: be.comp.programming,nl.comp.programmeren