home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
pc3270sa.zip
/
vbdde
/
fsrchstr.frm
< prev
next >
Wrap
Text File
|
2002-02-28
|
9KB
|
292 lines
VERSION 4.00
Begin VB.Form FormSearchForString
Caption = "Search for String"
ClientHeight = 4224
ClientLeft = 4344
ClientTop = 3084
ClientWidth = 3768
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 4548
Left = 4296
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 4224
ScaleWidth = 3768
Top = 2808
Visible = 0 'False
Width = 3864
Begin VB.TextBox SearchStringDataText
BackColor = &H00C0FFFF&
ForeColor = &H00FF0000&
Height = 288
Left = 2400
Locked = -1 'True
MaxLength = 4
TabIndex = 12
TabStop = 0 'False
Top = 3240
Width = 612
End
Begin VB.Frame Frame4
Caption = "Results of Search"
Height = 612
Left = 120
TabIndex = 13
Top = 3000
Width = 3492
Begin VB.Label Label3
Caption = "Target String's Position"
Height = 252
Left = 120
TabIndex = 14
Top = 240
Width = 2052
End
End
Begin VB.Frame Frame2
Caption = "&Search String"
Height = 852
Left = 240
TabIndex = 3
Top = 720
Width = 3252
Begin VB.TextBox SearchStringText
BackColor = &H00FFFFC0&
Height = 492
Left = 120
MaxLength = 255
MultiLine = -1 'True
ScrollBars = 1 'Horizontal
TabIndex = 4
Top = 240
Width = 3012
End
End
Begin VB.ComboBox SessionIdList
BackColor = &H00FFFFC0&
ForeColor = &H00000000&
Height = 288
ItemData = "FSRCHSTR.frx":0000
Left = 1320
List = "FSRCHSTR.frx":0052
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 2
Top = 360
Width = 492
End
Begin VB.CommandButton ExitDlg
Cancel = -1 'True
Caption = "E&xit"
Height = 372
Left = 2520
TabIndex = 11
Top = 3720
Width = 852
End
Begin VB.CommandButton Execute
Caption = "&Execute"
Default = -1 'True
Height = 372
Left = 360
TabIndex = 10
Top = 3720
Width = 876
End
Begin VB.Frame Frame1
Caption = "Search Parameters"
ForeColor = &H80000008&
Height = 2652
Left = 120
TabIndex = 0
Top = 120
Width = 3516
Begin VB.OptionButton BackwardOption
Caption = "&Backward"
ForeColor = &H80000008&
Height = 252
Left = 1920
TabIndex = 9
Top = 2160
Width = 1164
End
Begin VB.OptionButton ForwardOption
Caption = "&Forward"
ForeColor = &H80000008&
Height = 252
Left = 480
TabIndex = 8
Top = 2160
Value = -1 'True
Width = 1164
End
Begin VB.TextBox SearchStartPosText
BackColor = &H00FFFFC0&
ForeColor = &H00000000&
Height = 288
Left = 2160
MaxLength = 4
TabIndex = 6
Text = "0000"
Top = 1560
Width = 492
End
Begin VB.Frame Frame3
Caption = "Search Direction"
Height = 612
Left = 120
TabIndex = 7
Top = 1920
Width = 3252
End
Begin VB.Label Label2
Caption = "Session &Id"
Height = 252
Left = 120
TabIndex = 1
Top = 240
Width = 1092
End
Begin VB.Label Label1
Caption = "Search Beginning &Point"
ForeColor = &H80000008&
Height = 252
Left = 120
TabIndex = 5
Top = 1560
Width = 2028
End
End
End
Attribute VB_Name = "FormSearchForString"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Sub Execute_Click()
On Error GoTo ErrHandler
FunctionComp = True
OldMousePointer = MousePointer
MousePointer = 11 ' Hour Glass Mouse Pointer
DisplayType$ = GetDisplayType$(SessionIdList.Text)
If DisplayType$ = "NONE" Then
MousePointer = OldMousePointer
MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
Exit Sub
End If
temp$ = LTrim$(RTrim$(SessionIdList.Text))
Topic$ = "Session" + temp$
Item$ = GetSearchStringItem()
If Len(Item$) = 0 Then
MousePointer = OldMousePointer
MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
Exit Sub
End If
rc = DoEvents() 'If you use VisualBasic V2.0, call
'DoEvents function each time before
'starting DDE conversation.
SearchStringDataText.LinkTimeout = -1
SearchStringDataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
SearchStringDataText.LinkMode = COLD
SearchStringDataText.LinkItem = Item$
SearchStringDataText.LinkRequest
SearchStringDataText.LinkMode = NONE
MousePointer = OldMousePointer
If FunctionComp = True Then
MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
EndStatus$ = MSG_OK
Else
MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
EndStatus$ = MSG_NG
End If
TempLogData$ = Time$ + ":Search for String : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_ITEM + """" + Item$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + "Data =" + """" + SearchStringDataText.Text + """" + Chr$(13) + Chr$(10)
LogData$(LogEnd) = TempLogData$
UpdateLogPointer
Loged = True
Exit Sub
ErrHandler:
FunctionComp = False
Resume Next
End Sub
Private Sub ExitDlg_Click()
Hide
End Sub
Private Function GetSearchStringItem() As String
Dim ReturnString As String
ReturnString = "STRING"
temp$ = RTrim$(LTrim$(SearchStartPosText.Text))
If ForwardOption.Value = True Then
Temp2$ = "1"
Else
Temp2$ = "0"
End If
Temp3$ = RTrim$(LTrim$(SearchStringText.Text))
If Len(Temp3$) > 0 Then
If (Left$(Temp3$, 1) <> """") Then
Temp3$ = """" + Temp3$ + """"
End If
GetSearchStringItem = "STRING(" + temp$ + "," + Temp2$ + "," + Temp3$ + ")"
Else
GetSearchStringItem = ""
End If
End Function
Private Sub UpdateLogPointer()
LogEnd = LogEnd + 1
If LogEnd = MAXLOGNUM + 1 Then
LogEnd = 0
End If
If LogTop = LogEnd Then
LogTop = LogTop + 1
If LogTop = MAXLOGNUM + 1 Then
LogTop = 0
End If
End If
End Sub
Private Sub Form_Load()
SessionIdList.ListIndex = 0
AdjustForNT351 FormSearchForString
End Sub
Private Sub SearchStartPosText_Change()
CleanUpNumberText SearchStartPosText
End Sub
Private Sub SearchStartPosText_LostFocus()
length = Len(SearchStartPosText.Text)
If length < 4 Then
SearchStartPosText.SelStart = 0
SearchStartPosText.SelText = Mid("0000", 1, 4 - length)
End If
End Sub