home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pc3270sa.zip / vbdde / fsrchstr.frm < prev    next >
Text File  |  2002-02-28  |  9KB  |  292 lines

  1. VERSION 4.00
  2. Begin VB.Form FormSearchForString 
  3.    Caption         =   "Search for String"
  4.    ClientHeight    =   4224
  5.    ClientLeft      =   4344
  6.    ClientTop       =   3084
  7.    ClientWidth     =   3768
  8.    BeginProperty Font 
  9.       name            =   "MS Sans Serif"
  10.       charset         =   0
  11.       weight          =   700
  12.       size            =   7.8
  13.       underline       =   0   'False
  14.       italic          =   0   'False
  15.       strikethrough   =   0   'False
  16.    EndProperty
  17.    ForeColor       =   &H80000008&
  18.    Height          =   4548
  19.    Left            =   4296
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   4224
  23.    ScaleWidth      =   3768
  24.    Top             =   2808
  25.    Visible         =   0   'False
  26.    Width           =   3864
  27.    Begin VB.TextBox SearchStringDataText 
  28.       BackColor       =   &H00C0FFFF&
  29.       ForeColor       =   &H00FF0000&
  30.       Height          =   288
  31.       Left            =   2400
  32.       Locked          =   -1  'True
  33.       MaxLength       =   4
  34.       TabIndex        =   12
  35.       TabStop         =   0   'False
  36.       Top             =   3240
  37.       Width           =   612
  38.    End
  39.    Begin VB.Frame Frame4 
  40.       Caption         =   "Results of Search"
  41.       Height          =   612
  42.       Left            =   120
  43.       TabIndex        =   13
  44.       Top             =   3000
  45.       Width           =   3492
  46.       Begin VB.Label Label3 
  47.          Caption         =   "Target String's Position"
  48.          Height          =   252
  49.          Left            =   120
  50.          TabIndex        =   14
  51.          Top             =   240
  52.          Width           =   2052
  53.       End
  54.    End
  55.    Begin VB.Frame Frame2 
  56.       Caption         =   "&Search String"
  57.       Height          =   852
  58.       Left            =   240
  59.       TabIndex        =   3
  60.       Top             =   720
  61.       Width           =   3252
  62.       Begin VB.TextBox SearchStringText 
  63.          BackColor       =   &H00FFFFC0&
  64.          Height          =   492
  65.          Left            =   120
  66.          MaxLength       =   255
  67.          MultiLine       =   -1  'True
  68.          ScrollBars      =   1  'Horizontal
  69.          TabIndex        =   4
  70.          Top             =   240
  71.          Width           =   3012
  72.       End
  73.    End
  74.    Begin VB.ComboBox SessionIdList 
  75.       BackColor       =   &H00FFFFC0&
  76.       ForeColor       =   &H00000000&
  77.       Height          =   288
  78.       ItemData        =   "FSRCHSTR.frx":0000
  79.       Left            =   1320
  80.       List            =   "FSRCHSTR.frx":0052
  81.       Sorted          =   -1  'True
  82.       Style           =   2  'Dropdown List
  83.       TabIndex        =   2
  84.       Top             =   360
  85.       Width           =   492
  86.    End
  87.    Begin VB.CommandButton ExitDlg 
  88.       Cancel          =   -1  'True
  89.       Caption         =   "E&xit"
  90.       Height          =   372
  91.       Left            =   2520
  92.       TabIndex        =   11
  93.       Top             =   3720
  94.       Width           =   852
  95.    End
  96.    Begin VB.CommandButton Execute 
  97.       Caption         =   "&Execute"
  98.       Default         =   -1  'True
  99.       Height          =   372
  100.       Left            =   360
  101.       TabIndex        =   10
  102.       Top             =   3720
  103.       Width           =   876
  104.    End
  105.    Begin VB.Frame Frame1 
  106.       Caption         =   "Search Parameters"
  107.       ForeColor       =   &H80000008&
  108.       Height          =   2652
  109.       Left            =   120
  110.       TabIndex        =   0
  111.       Top             =   120
  112.       Width           =   3516
  113.       Begin VB.OptionButton BackwardOption 
  114.          Caption         =   "&Backward"
  115.          ForeColor       =   &H80000008&
  116.          Height          =   252
  117.          Left            =   1920
  118.          TabIndex        =   9
  119.          Top             =   2160
  120.          Width           =   1164
  121.       End
  122.       Begin VB.OptionButton ForwardOption 
  123.          Caption         =   "&Forward"
  124.          ForeColor       =   &H80000008&
  125.          Height          =   252
  126.          Left            =   480
  127.          TabIndex        =   8
  128.          Top             =   2160
  129.          Value           =   -1  'True
  130.          Width           =   1164
  131.       End
  132.       Begin VB.TextBox SearchStartPosText 
  133.          BackColor       =   &H00FFFFC0&
  134.          ForeColor       =   &H00000000&
  135.          Height          =   288
  136.          Left            =   2160
  137.          MaxLength       =   4
  138.          TabIndex        =   6
  139.          Text            =   "0000"
  140.          Top             =   1560
  141.          Width           =   492
  142.       End
  143.       Begin VB.Frame Frame3 
  144.          Caption         =   "Search Direction"
  145.          Height          =   612
  146.          Left            =   120
  147.          TabIndex        =   7
  148.          Top             =   1920
  149.          Width           =   3252
  150.       End
  151.       Begin VB.Label Label2 
  152.          Caption         =   "Session &Id"
  153.          Height          =   252
  154.          Left            =   120
  155.          TabIndex        =   1
  156.          Top             =   240
  157.          Width           =   1092
  158.       End
  159.       Begin VB.Label Label1 
  160.          Caption         =   "Search Beginning &Point"
  161.          ForeColor       =   &H80000008&
  162.          Height          =   252
  163.          Left            =   120
  164.          TabIndex        =   5
  165.          Top             =   1560
  166.          Width           =   2028
  167.       End
  168.    End
  169. End
  170. Attribute VB_Name = "FormSearchForString"
  171. Attribute VB_Creatable = False
  172. Attribute VB_Exposed = False
  173.  
  174. Private Sub Execute_Click()
  175. On Error GoTo ErrHandler
  176.    FunctionComp = True
  177.    
  178.    OldMousePointer = MousePointer
  179.    MousePointer = 11 ' Hour Glass Mouse Pointer
  180.  
  181.    DisplayType$ = GetDisplayType$(SessionIdList.Text)
  182.    
  183.    If DisplayType$ = "NONE" Then
  184.      MousePointer = OldMousePointer
  185.      MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
  186.      Exit Sub
  187.    End If
  188.  
  189.    temp$ = LTrim$(RTrim$(SessionIdList.Text))
  190.    Topic$ = "Session" + temp$
  191.  
  192.    Item$ = GetSearchStringItem()
  193.    If Len(Item$) = 0 Then
  194.       MousePointer = OldMousePointer
  195.       MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  196.       Exit Sub
  197.    End If
  198.    
  199.    rc = DoEvents()              'If you use VisualBasic V2.0, call
  200.                                 'DoEvents function each time before
  201.                                 'starting DDE conversation.
  202.    SearchStringDataText.LinkTimeout = -1
  203.    SearchStringDataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
  204.    SearchStringDataText.LinkMode = COLD
  205.    SearchStringDataText.LinkItem = Item$
  206.    SearchStringDataText.LinkRequest
  207.    SearchStringDataText.LinkMode = NONE
  208.  
  209.    MousePointer = OldMousePointer
  210.    If FunctionComp = True Then
  211.       MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
  212.       EndStatus$ = MSG_OK
  213.    Else
  214.       MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
  215.       EndStatus$ = MSG_NG
  216.    End If
  217.    TempLogData$ = Time$ + ":Search for String : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
  218.    TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
  219.    TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
  220.    TempLogData$ = TempLogData$ + MSG_ITEM + """" + Item$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
  221.    TempLogData$ = TempLogData$ + "Data =" + """" + SearchStringDataText.Text + """" + Chr$(13) + Chr$(10)
  222.    LogData$(LogEnd) = TempLogData$
  223.    UpdateLogPointer
  224.    Loged = True
  225.    Exit Sub
  226.  
  227. ErrHandler:
  228.    FunctionComp = False
  229.    Resume Next
  230. End Sub
  231.  
  232. Private Sub ExitDlg_Click()
  233.     Hide
  234. End Sub
  235.  
  236. Private Function GetSearchStringItem() As String
  237.    Dim ReturnString  As String
  238.    ReturnString = "STRING"
  239.  
  240.    temp$ = RTrim$(LTrim$(SearchStartPosText.Text))
  241.  
  242.    If ForwardOption.Value = True Then
  243.       Temp2$ = "1"
  244.    Else
  245.       Temp2$ = "0"
  246.    End If
  247.  
  248.    Temp3$ = RTrim$(LTrim$(SearchStringText.Text))
  249.    If Len(Temp3$) > 0 Then
  250.       If (Left$(Temp3$, 1) <> """") Then
  251.          Temp3$ = """" + Temp3$ + """"
  252.       End If
  253.       GetSearchStringItem = "STRING(" + temp$ + "," + Temp2$ + "," + Temp3$ + ")"
  254.    Else
  255.      GetSearchStringItem = ""
  256.    End If
  257. End Function
  258.  
  259. Private Sub UpdateLogPointer()
  260.     LogEnd = LogEnd + 1
  261.     If LogEnd = MAXLOGNUM + 1 Then
  262.        LogEnd = 0
  263.     End If
  264.  
  265.     If LogTop = LogEnd Then
  266.        LogTop = LogTop + 1
  267.        If LogTop = MAXLOGNUM + 1 Then
  268.           LogTop = 0
  269.        End If
  270.     End If
  271. End Sub
  272.  
  273. Private Sub Form_Load()
  274.   SessionIdList.ListIndex = 0
  275.   AdjustForNT351 FormSearchForString
  276. End Sub
  277.  
  278.  
  279. Private Sub SearchStartPosText_Change()
  280.   CleanUpNumberText SearchStartPosText
  281. End Sub
  282.  
  283. Private Sub SearchStartPosText_LostFocus()
  284.   length = Len(SearchStartPosText.Text)
  285.   If length < 4 Then
  286.     SearchStartPosText.SelStart = 0
  287.     SearchStartPosText.SelText = Mid("0000", 1, 4 - length)
  288.   End If
  289. End Sub
  290.  
  291.  
  292.