home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmServer
- Caption = "Server"
- ClientHeight = 2190
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 4830
- LinkTopic = "Form1"
- ScaleHeight = 2190
- ScaleWidth = 4830
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton cmdClient
- Caption = "&Client"
- Height = 465
- Left = 210
- TabIndex = 2
- Top = 150
- Width = 2910
- End
- Begin VB.CommandButton cmdOK
- Caption = "OK"
- Height = 465
- Left = 3450
- TabIndex = 0
- Top = 150
- Width = 1200
- End
- Begin VB.Label Label1
- BorderStyle = 1 'Fixed Single
- Height = 1335
- Left = 210
- TabIndex = 1
- Top = 690
- Width = 2895
- End
- Attribute VB_Name = "frmServer"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' *******************************************************************
- ' ** This example was created by Fishhead Software, 1998
- ' *******************************************************************
- Option Explicit
- Private m_Share As fsShare
- Private m_Handle As Long
- Private WithEvents m_Events As fsEvents
- Attribute m_Events.VB_VarHelpID = -1
- Private Sub cmdClient_Click()
- Dim s(2) As Single
- ' ** Position the server in upper left corner
- ' ** of the screen and have the client be
- ' ** positioned at bottom right corner of
- ' ** the server;
- Me.Move 0, 0
- s(1) = Me.Left + Me.Width
- s(2) = Me.Top + Me.Height
- ' ** Let the client know the width and height
- Call m_Share.PutData("pos", s())
- ' ** Lauch the client
- Shell "client.exe", vbNormalFocus
- Label1.Caption = ""
- Label1.Refresh
-
- End Sub
- Private Sub cmdOK_Click()
- Unload Me
- End Sub
- Private Sub Form_Initialize()
- Set m_Share = New fsShare
- ' ** We need to get messages back from the cleint
- Set m_Events = m_Share.fsEvents
- ' ** Start this application as a server application
- m_Handle = m_Share.StartServer("my server")
- End Sub
- Private Sub Form_Load()
- ' ** Make some data available for the client
- Call m_Share.PutData("Company", "Fishhead Software")
- Call m_Share.PutData("Product", "fsShare")
- ' ** You can even pass objects;
- Call m_Share.PutObject("server form", frmServer)
- Label1.Caption = "First press the client button. This will load the client."
- End Sub
- Private Sub Form_Terminate()
- ' ** Unload the server, this will disconnect
- ' ** any clients that may be attached. Also,
- ' ** all the data will be removed;
- m_Share.StopServer
- End Sub
- Private Sub m_Events_ReceiveMessage(ByVal Handle As Long, ByVal Message As Long, ByVal Data As Variant)
- Select Case Message
- ' ** Eccho the pass in text if its
- ' ** the user's defined message;
- Case (fsSHFMUser + 1)
- Label1.Caption = Data
- End Select
- End Sub
-