http://advosol.com/manuals/opcdanet/topic891.html

Change the current browse position. Move up, down or to in the hierarchical address space. ( IOPCBrowseServerAddressSpace:: ChangeBrowsePosition )
The function will return E_FAIL if called for a FLAT space. An error is returned if the passed string does not represent a 'branch'. Moving UP from the 'root' will return E_FAIL.
Note OPC_BROWSE_TO is new for version 2.0. Clients should be prepared to handle E_INVALIDARG if they pass this to a 1.0 server.

Syntax

Visual Basic (Usage)
Copy Code

Dim instance As OpcServer
Dim direction As OPCBROWSEDIRECTION
Dim name As String
Dim value As Integer   value = instance.ChangeBrowsePosition(direction, name)

C#

public int ChangeBrowsePosition(    OPCBROWSEDIRECTION direction,    string name
)
Parameters
direction
IN: direction, up, down or to
name
IN: branch name to move to
Return Value

HRESULTS
Description

S_OK
Successful Read.

E_FAIL
The call failed with an unspecific error.

E_OUTOFMEMORY
Not enough memory.

OPC_E_INVALIDARG
An argument of the call was invalid.

Example

C#
Copy Code

Srv.ChangeBrowsePosition( OPCBROWSEDIRECTION.OPC_BROWSE_UP, "" );  // to parent
Srv.ChangeBrowsePosition( OPCBROWSEDIRECTION.OPC_BROWSE_DOWN, "Device1" );
Srv.ChangeBrowsePosition( OPCBROWSEDIRECTION.OPC_BROWSE_TO, "" ); // to root
Srv.ChangeBrowsePosition( OPCBROWSEDIRECTION.OPC_BROWSE_TO, "Plant3.Section5.Device2" );

Visual Basic
Copy Code

Srv.ChangeBrowsePosition( OPCBROWSEDIRECTION.OPC_BROWSE_UP, "" )  ' to parent
Srv.ChangeBrowsePosition( OPCBROWSEDIRECTION.OPC_BROWSE_DOWN, "Device1" )
Srv.ChangeBrowsePosition( OPCBROWSEDIRECTION.OPC_BROWSE_TO, "" )  ' to root
Srv.ChangeBrowsePosition( OPCBROWSEDIRECTION.OPC_BROWSE_TO, "Plant3.Section5.Device2" )

Requirements

OPC DA Server Version: V2

See Also

Reference
OpcServer Class
OpcServer Members
posted on 2014-11-06 13:38  子清  阅读(653)  评论(0编辑  收藏  举报