⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connectserver.frm

📁 此文件为OPC client VBTend 源代码,在VB开发环境下调试运行
💻 FRM
字号:
VERSION 5.00
Begin VB.Form ConnectServer 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Connect To OPC Server"
   ClientHeight    =   2985
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   7140
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2985
   ScaleWidth      =   7140
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox ServerComputer 
      Height          =   288
      Left            =   1560
      TabIndex        =   8
      Top             =   600
      Width           =   3972
   End
   Begin VB.TextBox OPCServerName 
      Height          =   288
      Left            =   1560
      TabIndex        =   7
      Top             =   120
      Width           =   3972
   End
   Begin VB.CommandButton Find 
      Caption         =   "&Find"
      Height          =   372
      Left            =   5760
      TabIndex        =   6
      Top             =   1200
      Width           =   1212
   End
   Begin VB.ListBox OPCServerList 
      Height          =   1425
      Left            =   1560
      TabIndex        =   5
      Top             =   1200
      Width           =   3972
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "Cancel"
      Height          =   375
      Left            =   5760
      TabIndex        =   1
      Top             =   600
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "OK"
      Height          =   375
      Left            =   5760
      TabIndex        =   0
      Top             =   120
      Width           =   1215
   End
   Begin VB.Label Label3 
      Caption         =   "Server List:"
      Height          =   252
      Left            =   120
      TabIndex        =   4
      Top             =   1200
      Width           =   972
   End
   Begin VB.Label Label2 
      Caption         =   "Server Computer:"
      Height          =   252
      Left            =   120
      TabIndex        =   3
      Top             =   600
      Width           =   1332
   End
   Begin VB.Label Label1 
      Caption         =   "Server:"
      Height          =   252
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   612
   End
End
Attribute VB_Name = "ConnectServer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'///////////////////////////////////////////////////////////////////////////
'
'  OPC Trend VB Client: ConnectServer.frm
'                       (Source File)
'
'///////////////////////////////////////////////////////////////////////////
'
'          Author: Raphael Imhof
'    Initial Date: 11/04/98
'       $Workfile: ConnectServer.frm $
'       $Revision: 1 $
'           $Date: 7/27/99 5:13p $
'   Target System: Microsoft Windows NT 4.0
'     Environment: Visual Basic 6.0 / OPC DataAccess 2.0
'         Remarks:
'
'///////////////////////////////////////////////////////////////////////////
'
'     Description: implementation of the server list form.
'
'
'///////////////////////////////////////////////////////////////////////////
'
'  History of Changes     (Please remove very old comments and blank lines!)
'            $Log: /IDK/OPCServer/clients/VB/Trend/ConnectServer.frm $
' 
' 1     7/27/99 5:13p Imhof
' 
' 1     7/27/99 4:37p Imhof
' 
' 8     2/01/99 11:33a Imhof
' Corrected OPC automation DLL problem.
'
' 7     1/23/99 9:37a Imhof
' If server list is empty no item gets selected.
'
' 6     1/20/99 3:09p Imhof
' Header: updated log
'
' 4     1/15/99 10:43a Imhof
' Updated headers and corrected time stamp problem
'
'
'  $Nokeywords:$ (To avoid useless search while checking in.)
'///////////////////////////////////////////////////////////////////////////
'  Copyright (C) 1999, Siemens Building Technologies, Inc. Landis Division
'
'  SIEMENS BUILDING TECHNOLOGIES, INC. IS PROVIDING THE FOLLOWING EXAMPLES
'  OF CODE AS SAMPLE ONLY.
'  SIEMENS BUILDING TECHNOLOGIES, INC. MAKES NO REPRESENTATIONS OR WARRANTIES
'  OF ANY KIND WITH RESPECT TO THE VALIDTY OF THE CODES OR DESIRED RESULTS
'  AND DISCLAIMS ALL SUCH REPRESENTATIONS AND WARRANTIES, INCLUDING FOR EXAMPLE,
'  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
'  SIEMENS BUILIDNG TECHNOLOGIES, INC. DOES NOT REPRESENT OR WARRANT THAT
'  THE FOLLOWING CODE SAMPLES ARE ACCURATE, VALID, COMPLETE OR CURRENT.
'
'///////////////////////////////////////////////////////////////////////////

Option Explicit
Public iButtonPressed As Integer
Public sOPCServer As String
Public sServerComputer As String


Private Sub CancelButton_Click()
    iButtonPressed = -1
    Unload Me
End Sub

Private Sub Find_Click()
    On Error GoTo Error
    
    MousePointer = vbHourglass
    OPCServerList.Clear
    
    Dim Servers As Variant
    Servers = Trend.fMainForm.InfoSvr.GetOPCServers(ServerComputer.Text)
    
    Dim lastIndex As Integer
    lastIndex = 0
    Dim i As Long
    For i = LBound(Servers) To UBound(Servers)
        OPCServerList.AddItem Servers(i)
    Next i
    
    If OPCServerList.ListCount > 0 Then
        OPCServerList.Selected(0) = True
    End If
    
    MousePointer = vbDefault
    Exit Sub
    
Error:
    MousePointer = vbDefault
    'if the ServerComputer.Text has no OPC server the GetOPCServers will fail !
    'following statement will in this cas enot display an error.
    Trend.fMainForm.InfoSvr.GetErrorString (Err.Number)
    
End Sub

Private Sub Form_Load()
    iButtonPressed = -1
    Find_Click
End Sub

Private Sub OKButton_Click()
    iButtonPressed = 1 'OK
    sOPCServer = OPCServerName.Text
    sServerComputer = ServerComputer.Text
    Unload Me
End Sub

Private Sub OPCServerList_Click()
    OPCServerName.Text = OPCServerList.Text
End Sub


Private Sub OPCServerList_DBlClick()
    OPCServerName.Text = OPCServerList.Text
    OKButton_Click
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -