home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / ENTRPRIS / PASSTHRU / PASS_CLI.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1996-11-23  |  5.4 KB  |  164 lines

  1. VERSION 5.00
  2. Begin VB.Form frmClient 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Pass Through Client"
  6.    ClientHeight    =  
  7.    ClientLeft   $  =   3945
  8.    ClientTop       =   3210
  9.    ClientWidth     =   3825
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    PaletteMode     =   1  'UseZOrder
  13.    ScaleHeight     =   2520
  14.    ScaleWidth      =   3825
  15.    Begin VB.Frame Frame2 
  16.       Caption         =   "Hello Server"
  17.       Height          =   750
  18.       Left            =   135
  19.       TabIndex        =   7
  20.       Top             =   105
  21.       Width           =   3540
  22.       Begin VB.CommandButton cmdSayHello 
  23.          Caption         =   "Say Hello"
  24.          Height          =   300
  25.          Left            =   2400
  26.          TabIndex        =   8
  27.          Top             =   270
  28.          Width           =   1050
  29.       End
  30.    End
  31.    Begin VB.Frame Frame1 
  32.       Ca
  33. tion         =   "Interface Server"
  34.       Height          =   9=0
  35.     ' Left            =   135
  36.       TabIndex        =   1
  37.       Top             = ! 960
  38.       Width           =   3540
  39.       Begin VB.CommandButton cmdUpdate 
  40.          Caption         =   "Updyte"
  41.          Height          =   300
  42.          Left            =   2400
  43.      TabIndex        =   6
  44.          Top             =   270
  45.          Width           =   1050
  46.       End
  47.       Begin VB.Label lab1 
  48.     BackColor       =   &H00C0C0C0&
  49.          Caption         =   "Date:"
  50.          Height          =
  51.          Index           =   0
  52.          Left            =   185
  53.          TabIndex      < =   5
  54.          Top   
  55.          =   315
  56.          Width           =   465
  57.       End
  58.       Begin VB.Label lab1 
  59.          BackColor       =   &H00C0C0C0&
  60.          Caption         =   "Time:"
  61. (        Height          =   270
  62.          Index    
  63.       =
  64.          Left            =   195
  65.          TabIndex        =   4
  66.        Top  $          =   660
  67.          Width           =   450
  68.       End
  69.       Begin VB.Label labDate 
  70.          BackColor       =   &H00C0C0C0&
  71.          Caption         =   "labDate"
  72.          Height          =   210
  73.          Left            =   690
  74.          TabIndex        =   3
  75.          Top             =   315
  76.          Width           =   840
  77.       End
  78.       Begin VB.Label labTime 
  79.          BackColor       =   &H00C0C0C0&
  80.          Caption         =   "labTime"
  81.          Height          =   210
  82.          Left            =   690
  83.          TabIndex        =   2
  84.          Top             =   660
  85.          Width           =   840
  86.       End
  87.    End
  88.    Begin VB.CommandButton cmdClose 
  89.       Caption         =   "Close"
  90.       Default         =   -1  'True
  91.       Height          =   300
  92.       Left            =   150
  93.       TabIndex        =   0
  94.       Top             =   2085
  95.       Width           =   1050
  96.    End
  97. Attribute VB_Name = "frmClient"
  98. Attribute VB_GlobalNameSpace = False
  99. Attribute VB_Creatable = False
  100. Attribute VB_PredeclaredId = True
  101. Attribute VB_Exposed = False
  102. Dim mobjPassThruSvr As Object
  103. Dim mbPassThruSvrCreated As Integer
  104. Private Sub cmdClose_Click()
  105.   Unload frmClient
  106. End Sub
  107. Private Sub cmdSayHello_Click()
  108. 'This routine uses the PassThru server to receive references to an OLE server that it wants to talk to.
  109. 'On a single machine, this is not very interesting... but if the PassThru server is registered for
  110. 'remote execution on another machine through Remote Automation, then this method provides a
  111. 'simple way for clients to access InProcess servers that also reside on the remote machine.
  112.   Dim bSuccess  As Integer
  113.   Dim objServer As Object
  114.   On Error GoTo shError
  115.   Set objServer = mobjPassThruSvr.RunServer("HelloProj.HelloClass", bSuccess)
  116.   If bSuccess Then MsgBox objServer.SayHello
  117.   Set objServer = Nothing
  118.   GoTo shExit
  119. shError:
  120.   MsgBox Error$
  121.   Resume shExit
  122. shExit:
  123. End Sub
  124. Private Sub cmdUpdate_Click()
  125. 'This routine uses the PassThru server to receive references to an OLE server that it wants to talk to.
  126. 'On a single machine, this is not very interesting... but if the PassThru server is registered for
  127. 'remote execution on another machine through Remote Automation, then this method provides a
  128. 'simple way for clients to access InProcess servers that also reside on the remote machine.
  129.   Dim bSuccess  As Integer
  130.   Dim objInterface  As Object
  131.   Dim bInterfaceOpen As Integer
  132.   Dim objServer As Object
  133.   Dim bServerOpen As Integer
  134.   On Error GoTo cuError
  135.   Set objInterface = mobjPassThruSvr.RunServer("InterfaceProj.ServerInterface", bSuccess)
  136.   If Not bSuccess Then GoTo cuError2
  137.   bInterfaceOpen = True
  138.   Set objServer = objInterface.objGetClassInstance("InterfaceDateClass")
  139.   bServerOpen = True
  140.   labDate.Caption = objServer.GetDate
  141.   Set objServer = Nothing
  142.   bServerOpen = False
  143.   Set objServer = objInterface.objGetClassInstance("InterfaceTimeClass")
  144.   bServerOpen = True
  145.   labTime.Caption = objServer.GetTime
  146.   GoTo cuExit
  147. cuError:
  148.   MsgBox Error$
  149.   Resume cuExit
  150. cuError2:
  151.   MsgBox "Unable to connect to Server"
  152. cuExit:
  153.   If bServerOpen Then Set objServer = Nothing
  154.   If bInterfaceOpen Then Set objInterface = Nothing
  155. End Sub
  156. Private Sub Form_Load()
  157.   Set mobjPassThruSvr = CreateObject("PassThruProj.PassThruClass")
  158.   mbPassThruSvrCreated = True
  159.   cmdUpdate_Click
  160. End Sub
  161. Private Sub Form_Unload(Cancel As Integer)
  162.   If mbPassThruSvrCreated Then Set mobjPassThruSvr = Nothing
  163. End Sub
  164.