home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form USERDDE
- BackColor = &H00C0C0C0&
- Caption = "Interactive DDE"
- ClientHeight = 5070
- ClientLeft = 630
- ClientTop = 1455
- ClientWidth = 5775
- Height = 5760
- Icon = USERDDE.FRX:0000
- Left = 570
- LinkMode = 1 'Source
- LinkTopic = "UserDDE"
- ScaleHeight = 5070
- ScaleWidth = 5775
- Top = 825
- Width = 5895
- Begin Timer timNotify
- Enabled = 0 'False
- Left = 5880
- Top = 4560
- End
- Begin SSFrame frmLinkMode
- Caption = "Link Mode"
- Font3D = 0 'None
- Height = 1935
- Left = 2760
- TabIndex = 17
- Top = 120
- Width = 1455
- Begin SSOption optLinkMode
- Caption = "Noti&fy"
- Font3D = 0 'None
- Height = 255
- HelpContextID = 1130
- Index = 3
- Left = 120
- TabIndex = 21
- Top = 1440
- Width = 1215
- End
- Begin SSOption optLinkMode
- Caption = "&Manual"
- Font3D = 0 'None
- Height = 255
- HelpContextID = 1110
- Index = 2
- Left = 120
- TabIndex = 20
- Top = 1080
- Width = 1215
- End
- Begin SSOption optLinkMode
- Caption = "&Automatic"
- Font3D = 0 'None
- Height = 255
- HelpContextID = 1120
- Index = 1
- Left = 120
- TabIndex = 19
- Top = 720
- Width = 1215
- End
- Begin SSOption optLinkMode
- Caption = "&None"
- Font3D = 0 'None
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 18
- Top = 360
- Width = 1215
- End
- End
- Begin TextBox txtData
- Height = 1935
- HelpContextID = 1010
- Left = 240
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 9
- Top = 2640
- Width = 5295
- End
- Begin CommandButton cmdAction
- Caption = "&Exit"
- Height = 375
- Index = 3
- Left = 4440
- TabIndex = 14
- Top = 1680
- Width = 1095
- End
- Begin TextBox Text1
- Height = 375
- HelpContextID = 1010
- Index = 3
- Left = 1200
- TabIndex = 7
- Top = 1680
- Width = 855
- End
- Begin CommandButton cmdAction
- Caption = "E&xecute"
- Height = 375
- HelpContextID = 1230
- Index = 2
- Left = 4440
- TabIndex = 12
- Top = 1200
- Width = 1095
- End
- Begin TextBox Text1
- Height = 375
- HelpContextID = 1010
- Index = 2
- Left = 1200
- TabIndex = 5
- Top = 1200
- Width = 1335
- End
- Begin CommandButton cmdAction
- Caption = "&Poke"
- Height = 375
- HelpContextID = 1220
- Index = 1
- Left = 4440
- TabIndex = 11
- Top = 720
- Width = 1095
- End
- Begin TextBox Text1
- Height = 375
- HelpContextID = 1010
- Index = 1
- Left = 1200
- TabIndex = 3
- Top = 720
- Width = 1335
- End
- Begin CommandButton cmdAction
- Caption = "&Request"
- Default = -1 'True
- Height = 375
- HelpContextID = 1210
- Index = 0
- Left = 4440
- TabIndex = 10
- Top = 240
- Width = 1095
- End
- Begin TextBox Text1
- Height = 375
- HelpContextID = 1010
- Index = 0
- Left = 1200
- TabIndex = 1
- Top = 240
- Width = 1335
- End
- Begin Label lblStatus
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Height = 255
- Left = 1200
- TabIndex = 15
- Top = 4680
- Width = 4335
- End
- Begin Label lblStatusLabel
- BackColor = &H00C0C0C0&
- Caption = "Status:"
- Height = 255
- Left = 240
- TabIndex = 16
- Top = 4680
- Width = 735
- End
- Begin Label Label2
- BackColor = &H00C0C0C0&
- Caption = "Server | Topic | Item"
- Height = 255
- Left = 960
- TabIndex = 13
- Top = 2280
- Width = 4575
- End
- Begin Label Label3
- BackColor = &H00C0C0C0&
- Caption = "&Data:"
- Height = 255
- Left = 240
- TabIndex = 8
- Top = 2280
- Width = 615
- End
- Begin Label Label1
- BackColor = &H00C0C0C0&
- Caption = "Time&Out:"
- Height = 255
- Index = 3
- Left = 240
- TabIndex = 6
- Top = 1800
- Width = 735
- End
- Begin Label Label1
- BackColor = &H00C0C0C0&
- Caption = "&Item:"
- Height = 255
- Index = 2
- Left = 240
- TabIndex = 4
- Top = 1320
- Width = 735
- End
- Begin Label Label1
- BackColor = &H00C0C0C0&
- Caption = "&Topic:"
- Height = 255
- Index = 1
- Left = 240
- TabIndex = 2
- Top = 840
- Width = 735
- End
- Begin Label Label1
- BackColor = &H00C0C0C0&
- Caption = "&Server:"
- Height = 255
- Index = 0
- Left = 240
- TabIndex = 0
- Top = 360
- Width = 735
- End
- Begin Menu mnuSourcePopup
- Caption = "Sour&ce"
- HelpContextID = 2000
- Begin Menu mnuSource
- Caption = "&None"
- Checked = -1 'True
- HelpContextID = 2000
- Index = 0
- End
- Begin Menu mnuSource
- Caption = "&Server"
- HelpContextID = 2000
- Index = 1
- End
- End
- Begin Menu mnuFeaturePopup
- Caption = "Feat&ures"
- Begin Menu mnuFeature
- Caption = "&Always on Top"
- HelpContextID = 3010
- Index = 0
- End
- End
- ' Define LinkExecute attributes. NUMEXECUTECMDS
- ' is the number of execution commands MINUS 1.
- ' The EC_ constants define the id value of each
- ' valid execution command. These must be sequential
- ' numbering from 0 to NUMEXECUTECMDS.
- ' To add new commands:
- ' 1) increment NUMEXECUTECMDS
- ' 2) add a new EC_ constant equal to the new
- ' NUMEXECUTECMDS value.
- ' 3) Add to the DoLinkExecute procedure a Case
- ' statement to the Select Case code for
- ' handling the new command.
- Const NUMEXECUTECMDS = 1 ' Number of commands minus 1.
- Const EC_DISPLAYABOUT = 0
- Const EC_SHELLAPP = 1
- Dim ExecuteCmd(NUMEXECUTECMDS) As String
- Const IDX_SERVER = 0
- Const IDX_TOPIC = 1
- Const IDX_ITEM = 2
- Const IDX_TIMEOUT = 3
- Const IDX_TEXTDATA = 4
- Const LAST_ITEM = 4
- Const IDX_REQUEST = 0
- Const IDX_POKE = 1
- Const IDX_EXECUTE = 2
- Const IDX_DONE = 3
- Const IDM_TOPMOST = 0
- Const NONE = 0
- Const AUTOMATIC = 1
- Const SERVER = 1
- Const MANUAL = 2
- Const NOTIFY = 3
- ' Set the default LinkTimeout period
- Const DEFTIMEOUT = "50"
- Dim bStatus(LAST_ITEM) As Integer
- Function Cmd_ShellApp (Params As String)
- Dim rtn As Integer
- Dim sRtn As String
- Dim appname As String
- Dim state As Integer
- ' Shell the application defined by Params
- ' First, extract the application name
- If DoExtractParam(Params, appname) Then
- ' Next extract the show state, if specified
- state = 1
- If DoExtractParam(Params, sRtn) Then
- state = Val(sRtn)
- End If
- ' Now, shell the application
- Cmd_ShellApp = Shell(appname, state)
- Exit Function
- Else
- ' No app name found
- Cmd_ShellApp = False
- Exit Function
- End If
- End Function
- Sub cmdAction_Click (Index As Integer)
- Dim sTimeOut As String
- On Error GoTo cmdAction_Err
- ' Unload form if Index = IDX_DONE
- If Index = IDX_DONE Then Unload USERDDE
- ' Set the link timeout period for this operation.
- ' If no timeout period is set, initialize it to
- ' the global constant DEFTIMEOUT, specified in
- ' tenths of a second.
- sTimeOut = Text1(IDX_TIMEOUT).Text
- If sTimeOut = "" Then
- sTimeOut = DEFTIMEOUT:
- Text1(IDX_TIMEOUT).Text = DEFTIMEOUT
- End If
- txtData.LinkTimeout = Val(sTimeOut)
- Select Case Index
- Case IDX_REQUEST
- DdeRequest
- Case IDX_POKE
- DdePoke
- Case IDX_EXECUTE
- DdeExecute
- End Select
- Label2.Caption = Text1(IDX_SERVER).Text + " | " + Text1(IDX_TOPIC).Text + " | " + txtData.LinkItem
- Text1(IDX_ITEM).SetFocus
- cmdAction_Terminate:
- ' Reset Display Status just in case an error got bumped
- ' up to this routine without cleaning up properly.
- DisplayStatus ("")
- Exit Sub
- cmdAction_Err:
- Select Case Err
- Case FILE_NOT_FOUND
- ' If attempt to Shell start a server fails in the
- ' DdeRequest, DdePoke, or DdeExecute function
- ' because of an invalid file name, the
- ' FILE_NOT_FOUND error will be received by this
- ' calling routine. Handle accordingly.
- MsgBox "Error: Invalid Server Name"
- Text1(IDX_SERVER).SelStart = 0
- Text1(IDX_SERVER).SelLength = Len(Text1(IDX_SERVER).Text)
- Text1(IDX_SERVER).SetFocus
- Resume cmdAction_Terminate
- Case Else
- MsgBox "Error: " + Str$(Err) + ":" + Error$
- Resume cmdAction_Terminate
- End Select
- End Sub
- Sub DdeExecute ()
- Dim ii As Integer
- ' This routine sends an execution command stream to
- ' the server on behalf of the client application.
- On Error GoTo Err_DdeExecute
- Screen.MousePointer = 11 ' Set cursor to hourglass
- DisplayStatus ("Executing Commands at Server")
- txtData.LinkExecute txtData.Text
- ii = DoEvents()
- DdeExecute_Terminate:
- Screen.MousePointer = 1 ' Set cursor to arrow
- DisplayStatus ("")
- Exit Sub
- Err_DdeExecute:
- MsgBox "Error: " + Str$(Err) + ":" + Error$
- Resume DdeExecute_Terminate
- End Sub
- Sub DdePoke ()
- Dim ii As Integer
- On Error GoTo Err_DdePoke
- txtData.LinkItem = Text1(IDX_ITEM).Text
- DdePoke_Restart:
- DisplayStatus ("Poking Data back to Server")
- txtData.LinkPoke
- ii = DoEvents()
- DdePoke_Terminate:
- DisplayStatus ("")
- Exit Sub
- Err_DdePoke:
- MsgBox "Error: " + Str$(Err) + ":" + Error$
- Resume DdePoke_Terminate
- End Sub
- Sub DdeRequest ()
- Dim ii As Integer
- On Error GoTo Err_DdeRequest
- ' Check if satisfying notification
- If timNotify.Enabled Then
- timNotify.Enabled = False
- lblStatusLabel.ForeColor = &H0&
- DisplayStatus ("")
- End If
- txtData.LinkItem = Text1(IDX_ITEM).Text
- DdeRequest_Restart:
- DisplayStatus ("Making one-time request")
- txtData.LinkRequest
- ii = DoEvents()
- DdeRequest_Terminate:
- DisplayStatus ("")
- Exit Sub
- Err_DdeRequest:
- MsgBox "Error: " + Str$(Err) + ":" + Error$
- Error Err
- Resume DdeRequest_Terminate
- End Sub
- Sub DisplayStatus (sParam As String)
- lblStatus.Caption = sParam
- lblStatus.Refresh
- End Sub
- Function DoExtractParam (Params As String, sRtn As String)
- Dim pStart, pEnd As Integer
- Dim rtn As Integer
- DoExtractParam = True
- ' Extract next parameter
- If Len(Params) = 0 Then
- DoExtractParam = False
- Exit Function
- End If
- ' First, extract the next parameter and update the
- ' Params string.
- rtn = InStr(1, Params, ",") ' look next for commas
- If rtn > 0 Then
- ' More parameters follow. Extract the first into
- ' 'sRtn' and update the Params string
- sRtn = LTrim$(RTrim$(Left$(Params, rtn - 1)))
- Params = Right$(Params, Len(Params) - rtn)
- Else
- ' No parameters follow.
- sRtn = LTrim$(RTrim$(Params))
- Params = ""
- End If
- ' Clean up sRtn. Eliminate any leading or trailing
- ' parenthesis and blanks
- If Left$(sRtn, 1) = Chr$(34) Then
- sRtn = LTrim$(Right$(sRtn, Len(sRtn) - 1))
- End If
- If Right$(sRtn, 1) = Chr$(34) Then
- sRtn = RTrim$(Left$(sRtn, Len(sRtn) - 1))
- End If
- End Function
- Function DoLinkExecute (CmdStr As String)
- Dim CommandStr As String
- Dim CmdNumber As Integer
- Dim Params As String
- Dim rtn, ii As Integer
- ' Provide for simple execution commands.
- ' Return TRUE if successful, FALSE otherwise.
- ' Make local copy of command string. This local
- ' copy will be modified as commands and parameters
- ' are parsed from it.
- CommandStr = CmdStr
- ' Parse the first command from the command stream
- rtn = ParseCommand(CommandStr, CmdNumber, Params)
- Do While rtn <> -1
- ' Allow for multitasking after parsing each command.
- ii = DoEvents()
- ' This code provides processing for each of the
- ' valid commands known to this application. As new
- ' commands are added, a new Case statement must be
- ' added for each.
- Select Case CmdNumber
- Case EC_DISPLAYABOUT
- MsgBox "Display About..." + Params
- Case EC_SHELLAPP
- If Cmd_ShellApp(Params) = 0 Then GoTo ExecuteError
- Case Else
- End Select
- If rtn = 0 Then
- DoLinkExecute = False
- Exit Function
- End If
- ' Extract the next command from the command stream.
- rtn = ParseCommand(CommandStr, CmdNumber, Params)
- Loop
- ExecuteError:
- ' Error has occurred. Return TRUE. If no errors occur,
- ' this code should never be reached.
- DoLinkExecute = True
- End Function
- Sub Form_LinkClose ()
- DisplayStatus "Link Closed"
- End Sub
- Sub Form_LinkError (LinkErr As Integer)
- Dim sError, sTitle As String
- ' When USERDDE is acting as a server, it may receive
- ' run-time link errors. Process errors here.
- sError = "A Link Error Has Occurred. " + Chr$(13) + Chr$(10)
- sTitle = "DDE Link Error"
- Select Case LinkErr
- Case WRONG_FORMAT
- sError = sError + "Wrong Data Format."
- MsgBox sError, 0, sTitle
- 'Case REQUEST_WITHOUT_INIT
- 'Case DDE_WITHOUT_INIT
- 'Case ADVISE_WITHOUT_INIT
- 'Case POKE_WITHOUT_INIT
- Case DDE_SERVER_CLOSED
- sError = sError + "Requested DDE Server is closed."
- MsgBox sError, 0, sTitle
- Case TOO_MANY_LINKS
- sError = sError + "Too many links(128 max.)."
- MsgBox sError, 0, sTitle
- Case STRING_TOO_LONG
- sError = sError + "String too long."
- MsgBox sError, 0, sTitle
- 'Case INVALID_CONTROL_ARRAY_REFERENCE
- 'Case UNEXPECTED_DDE
- Case OUT_OF_MEMORY
- sError = sError + "Insufficient memory to complete operation."
- MsgBox sError, 0, sTitle
- 'Case SERVER_ATTEMPTED_CLIENT_OPERATION
- Case Else
- sError = sError + "Link Error Number: " + Str$(LinkErr)
- MsgBox sError, 0, sTitle
- End Select
- End Sub
- Sub Form_LinkExecute (CmdStr As String, Cancel As Integer)
- DisplayStatus "Link Execute Attempted"
- Cancel = DoLinkExecute(CmdStr)
- End Sub
- Sub Form_LinkOpen (Cancel As Integer)
- DisplayStatus "Link Opened"
- End Sub
- Sub Form_Load ()
- ' Initialize application
- optLinkMode(NONE).Value = True
- LoadExecuteCmds
- ' Set initial Source capability to NONE
- mnuSource_Click (NONE)
- ValidateLinkModes
- ValidateActions
- End Sub
- Sub Form_Unload (Cancel As Integer)
- ' Terminate the application
- End
- End Sub
- Sub LoadExecuteCmds ()
- ' Load Execution commands into array. To add new
- ' commands, be certain to update the NUMEXECUTECMDS
- ' constant in the forms general declarations section.
- ExecuteCmd(EC_DISPLAYABOUT) = "DisplayAbout"
- ExecuteCmd(EC_SHELLAPP) = "ShellApp"
- End Sub
- Sub mnuFeature_Click (Index As Integer)
- If mnuFeature(Index).Checked Then
- SetWindowPos hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
- Else
- SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
- End If
- ' Toggle menu checkmark
- mnuFeature(Index).Checked = Not mnuFeature(Index).Checked
- End Sub
- Sub mnuSource_Click (Index As Integer)
- Static nChecked As Integer
- ' Set menu check mark
- mnuSource(nChecked).Checked = False
- mnuSource(Index).Checked = True
- nChecked = Index
- ' Set the LinkMode
- LinkMode = Index
- End Sub
- Sub optLinkMode_Click (Index As Integer, Value As Integer)
- Dim sMsg As String
- On Error GoTo optLinkMode_Err
- ' Set the LINKMODE. Index will be defined as follows:
- ' Index LinkMode
- ' ----- --------
- ' 0 NONE
- ' 1 AUTOMATIC
- ' 2 MANUAL
- ' 3 NOTIFY
- optLinkMode_Restart:
- ' Reset LinkMode and display status
- lblStatus.Caption = ""
- txtData.LinkMode = NONE
- If Index = NONE Then
- Label2.Caption = ""
- Else
- ' Setup initial link info
- txtData.LinkTopic = Text1(IDX_SERVER).Text + "|" + Text1(IDX_TOPIC).Text
- txtData.LinkItem = Text1(IDX_ITEM).Text
- ' Set the link timeout period for this operation.
- ' If no timeout period is set, initialize it to
- ' the global constant DEFTIMEOUT, specified in
- ' tenths of a second.
- sTimeOut = Text1(IDX_TIMEOUT).Text
- If sTimeOut = "" Then
- sTimeOut = DEFTIMEOUT:
- Text1(IDX_TIMEOUT).Text = DEFTIMEOUT
- End If
- txtData.LinkTimeout = Val(sTimeOut)
- ' Set the LinkMode
- txtData.LinkMode = Index
- ' Set Server | Topic label field
- Label2.Caption = Text1(IDX_SERVER).Text + " | " + Text1(IDX_TOPIC).Text + " | " + Text1(IDX_ITEM).Text
- End If
- ValidateActions
- optLinkMode_Terminate:
- Exit Sub
- optLinkMode_Err:
- If Err = DDE_NO_APP Then
- ' Server is not loaded. Attempt to start.
- If StartServer() = 0 Then
- sMsg = "Unable to start server: "
- sMsg = sMsg + Text1(IDX_SERVER).Text
- MsgBox sMsg, 1, "DDE Error"
- Resume optLinkMode_Terminate
- Else
- Resume optLinkMode_Restart
- End If
- Else
- MsgBox "Error: " + Str$(Err) + ":" + Error$
- optLinkMode(NONE).Value = True
- lblStatus.Caption = Error$
- Resume optLinkMode_Terminate
- End If
- End Sub
- Function ParseCommand (CmdStr As String, CmdNumber As Integer, Params As String)
- Dim CmdStart, CmdEnd, NextCmd As Integer
- Dim pStart, pEnd As Integer
- Dim Cmd As String
- Dim ii As Integer
- ' Parse LinkExecute command and return the command number
- ' and the parameter string. Return 1 if a valid command
- ' is found, -1 if an invalid command is found, else
- ' return 0 if end of command string.
- ' Find first left square bracket. If CmdStart = 1, no bracket
- ' was found and we can assume no more commands exist so
- ' we return a 0.
- CmdStart = InStr(CmdStr, "[") + 1
- If CmdStart = 1 Then ParseCommand = 0: Exit Function
- ' If CmdEnd is -1, no following left parenthesis was found.
- ' Hence, an error was found.
- CmdEnd = InStr(CmdStart, CmdStr, "(") - 1
- If CmdEnd = -1 Then ParseCommand = -1: Exit Function
- Cmd = UCase$(LTrim$(RTrim$(Mid$(CmdStr, CmdStart, CmdEnd - CmdStart + 1))))
- pStart = InStr(CmdStart, CmdStr, "(") + 1
- pEnd = InStr(pStart, CmdStr, ")") - 1
- NextCmd = InStr(pEnd, CmdStr, "[")
- ' Find Cmd in ExecuteCmd array
- For ii = 0 To NUMEXECUTECMDS
- If UCase$(ExecuteCmd(ii)) = Cmd Then
- ' Return the command number and parameters
- Params = Mid$(CmdStr, pStart, pEnd - pStart + 1)
- CmdNumber = ii
- If NextCmd = 0 Then
- ' No following command; return 0
- ParseCommand = 0
- Else
- ' Additional commands follow. Remove this
- ' command from CmdStr and return 1.
- CmdStr = Right$(CmdStr, Len(CmdStr) - NextCmd + 1)
- ' Set the return value
- ParseCommand = 1
- End If
- Exit Function
- End If
- Next ii
- ParseCommand = -1
- End Function
- Function StartServer ()
- Dim ii As Integer
- ' Attempt to start server minimized without focus
- DisplayStatus ("Attempt to start server")
- Screen.MousePointer = 11 ' set cursor to hourglass
- StartServer = Shell(Text1(IDX_SERVER).Text + ".exe", 7)
- Screen.MousePointer = 1 ' set cursor to arrow
- ' Shelling takes time. Offer to share the processor.
- ii = DoEvents()
- DisplayStatus ("")
- End Function
- Sub Text1_Change (Index As Integer)
- ' Set the associated text controls status to
- ' TRUE if it contains text.
- bStatus(Index) = Len(Text1(Index).Text) > 0
- ValidateLinkModes
- ValidateActions
- End Sub
- Sub Text1_GotFocus (Index As Integer)
- ' Upon getting focus, select the entire text if
- ' some exists.
- Text1(Index).SelStart = 0
- Text1(Index).SelLength = Len(Text1(Index).Text)
- End Sub
- Sub Text1_KeyPress (Index As Integer, KeyAscii As Integer)
- ' Validate timeout entry
- If Index = IDX_TIMEOUT Then
- If KeyAscii < Asc("0") And KeyAscii > Asc("9") And KeyAscii <> Asc("-") Then
- KeyPress = 0
- End If
- End If
- End Sub
- Sub Timer1_Timer ()
- End Sub
- Sub timNotify_Timer ()
- Const RED = &HFF&
- Const GREEN = &HFF00&
- If lblStatusLabel.ForeColor = RED Then
- lblStatusLabel.ForeColor = GREEN
- Else
- lblStatusLabel.ForeColor = RED
- End If
- End Sub
- Sub txtData_Change ()
- ' Set the main text control status to
- ' TRUE if it contains text. This allows enabling
- ' of the EXECUTE action.
- bStatus(IDX_TEXTDATA) = Len(txtData.Text) > 0
- ValidateActions
- End Sub
- Sub txtData_LinkClose ()
- optLinkMode(NONE).Value = True
- ValidateActions
- DisplayStatus ("Dde Session Closed")
- End Sub
- Sub txtData_LinkError (LinkErr As Integer)
- Screen.MousePointer = 1 ' Reset mouse pointer
- MsgBox "Link Error " + Str$(LinkErr) + " has occurred"
- End Sub
- Sub txtData_LinkNotify ()
- DisplayStatus "DDE Notification from Server. 'REQUEST' updated data."
- timNotify.Interval = 500
- timNotify.Enabled = True
- End Sub
- Sub ValidateActions ()
- Dim bEnable As Integer
- ' Validate the action buttons.
- bEnable = txtData.LinkMode <> 0 And bStatus(IDX_ITEM)
- cmdAction(IDX_REQUEST).Enabled = bEnable
- cmdAction(IDX_POKE).Enabled = bEnable
- cmdAction(IDX_EXECUTE).Enabled = txtData.LinkMode <> 0 And bStatus(IDX_TEXTDATA)
- ' Set the default button.
- cmdAction(IDX_EXECUTE).Default = cmdAction(IDX_EXECUTE).Enabled
- cmdAction(IDX_REQUEST).Default = bEnable
- End Sub
- Sub ValidateLinkModes ()
- Dim bEnable As Integer
- bEnable = Len(Text1(IDX_SERVER)) > 0 And Len(Text1(IDX_TOPIC)) > 0
- ' Enable MANUAL LinkMode if the server and topic are specified
- optLinkMode(MANUAL).Enabled = bEnable
- ' Enable AUTOMATIC and NOTIFY only if the server, topic, AND item
- ' are specified
- optLinkMode(AUTOMATIC).Enabled = bEnable And Len(Text1(IDX_ITEM)) > 0
- optLinkMode(NOTIFY).Enabled = bEnable And Len(Text1(IDX_ITEM)) > 0
- End Sub
-