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

  1. VERSION 4.00
  2. Begin VB.Form FormSessExMacroWait 
  3.    Caption         =   "Wait"
  4.    ClientHeight    =   5532
  5.    ClientLeft      =   3588
  6.    ClientTop       =   1728
  7.    ClientWidth     =   4956
  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          =   5856
  19.    Left            =   3540
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form3"
  22.    ScaleHeight     =   5532
  23.    ScaleWidth      =   4956
  24.    Top             =   1452
  25.    Width           =   5052
  26.    Begin VB.ComboBox SessionIdList 
  27.       BackColor       =   &H00FFFFC0&
  28.       ForeColor       =   &H00000000&
  29.       Height          =   288
  30.       ItemData        =   "FSESEXWA.frx":0000
  31.       Left            =   1200
  32.       List            =   "FSESEXWA.frx":0052
  33.       Sorted          =   -1  'True
  34.       Style           =   2  'Dropdown List
  35.       TabIndex        =   2
  36.       Top             =   360
  37.       Width           =   492
  38.    End
  39.    Begin VB.CommandButton ExitDlg 
  40.       Cancel          =   -1  'True
  41.       Caption         =   "E&xit"
  42.       Height          =   372
  43.       Left            =   3120
  44.       TabIndex        =   26
  45.       Top             =   5040
  46.       Width           =   852
  47.    End
  48.    Begin VB.CommandButton Execute 
  49.       Caption         =   "&Execute"
  50.       Default         =   -1  'True
  51.       Height          =   372
  52.       Left            =   960
  53.       TabIndex        =   25
  54.       Top             =   5040
  55.       Width           =   852
  56.    End
  57.    Begin VB.Frame StringFrame 
  58.       Caption         =   "String"
  59.       Enabled         =   0   'False
  60.       ForeColor       =   &H80000008&
  61.       Height          =   852
  62.       Left            =   2160
  63.       TabIndex        =   23
  64.       Top             =   3960
  65.       Width           =   2508
  66.       Begin VB.TextBox StringText 
  67.          BackColor       =   &H00FFFFC0&
  68.          Enabled         =   0   'False
  69.          ForeColor       =   &H00000000&
  70.          Height          =   492
  71.          Left            =   96
  72.          MaxLength       =   255
  73.          MultiLine       =   -1  'True
  74.          ScrollBars      =   1  'Horizontal
  75.          TabIndex        =   24
  76.          Top             =   240
  77.          Width           =   2316
  78.       End
  79.    End
  80.    Begin VB.CheckBox DefPSPosCheck 
  81.       Caption         =   "&Define PS position"
  82.       Enabled         =   0   'False
  83.       ForeColor       =   &H80000008&
  84.       Height          =   375
  85.       Left            =   216
  86.       TabIndex        =   17
  87.       Top             =   3360
  88.       Width           =   1830
  89.    End
  90.    Begin VB.Frame CursorPosFrame 
  91.       Caption         =   "cursor position"
  92.       Enabled         =   0   'False
  93.       ForeColor       =   &H80000008&
  94.       Height          =   612
  95.       Left            =   2160
  96.       TabIndex        =   18
  97.       Top             =   3240
  98.       Width           =   2508
  99.       Begin VB.TextBox ColumnText 
  100.          BackColor       =   &H00FFFFC0&
  101.          Enabled         =   0   'False
  102.          ForeColor       =   &H00000000&
  103.          Height          =   288
  104.          Left            =   1824
  105.          TabIndex        =   22
  106.          Text            =   "01"
  107.          Top             =   240
  108.          Width           =   372
  109.       End
  110.       Begin VB.TextBox RowText 
  111.          BackColor       =   &H00FFFFC0&
  112.          Enabled         =   0   'False
  113.          ForeColor       =   &H00000000&
  114.          Height          =   288
  115.          Left            =   576
  116.          TabIndex        =   20
  117.          Text            =   "01"
  118.          Top             =   240
  119.          Width           =   396
  120.       End
  121.       Begin VB.Label ColumnLabel 
  122.          Caption         =   "&Column"
  123.          Enabled         =   0   'False
  124.          ForeColor       =   &H80000008&
  125.          Height          =   252
  126.          Left            =   1152
  127.          TabIndex        =   21
  128.          Top             =   240
  129.          Width           =   684
  130.       End
  131.       Begin VB.Label RowLabel 
  132.          Caption         =   "&Row"
  133.          Enabled         =   0   'False
  134.          ForeColor       =   &H80000008&
  135.          Height          =   252
  136.          Left            =   96
  137.          TabIndex        =   19
  138.          Top             =   240
  139.          Width           =   492
  140.       End
  141.    End
  142.    Begin VB.Frame TrigerTypeFrame 
  143.       Caption         =   "Triger type"
  144.       Enabled         =   0   'False
  145.       ForeColor       =   &H80000008&
  146.       Height          =   615
  147.       Left            =   2520
  148.       TabIndex        =   14
  149.       Top             =   2400
  150.       Width           =   2130
  151.       Begin VB.OptionButton StringOption 
  152.          Caption         =   "&String"
  153.          Enabled         =   0   'False
  154.          ForeColor       =   &H80000008&
  155.          Height          =   255
  156.          Left            =   1050
  157.          TabIndex        =   16
  158.          Top             =   240
  159.          Width           =   900
  160.       End
  161.       Begin VB.OptionButton CursorOption 
  162.          Caption         =   "Cu&rsor"
  163.          Enabled         =   0   'False
  164.          ForeColor       =   &H80000008&
  165.          Height          =   255
  166.          Left            =   90
  167.          TabIndex        =   15
  168.          Top             =   240
  169.          Value           =   -1  'True
  170.          Width           =   885
  171.       End
  172.    End
  173.    Begin VB.Frame WaitTypeFrame 
  174.       Caption         =   "Waiting type"
  175.       Enabled         =   0   'False
  176.       ForeColor       =   &H80000008&
  177.       Height          =   615
  178.       Left            =   408
  179.       TabIndex        =   11
  180.       Top             =   2400
  181.       Width           =   1935
  182.       Begin VB.OptionButton UntilOption 
  183.          Caption         =   "&Until"
  184.          Enabled         =   0   'False
  185.          ForeColor       =   &H80000008&
  186.          Height          =   252
  187.          Left            =   1155
  188.          TabIndex        =   13
  189.          Top             =   240
  190.          Width           =   684
  191.       End
  192.       Begin VB.OptionButton WhileOption 
  193.          Caption         =   "W&hile"
  194.          Enabled         =   0   'False
  195.          ForeColor       =   &H80000008&
  196.          Height          =   252
  197.          Left            =   120
  198.          TabIndex        =   12
  199.          Top             =   240
  200.          Value           =   -1  'True
  201.          Width           =   876
  202.       End
  203.    End
  204.    Begin VB.CheckBox WaitConCheck 
  205.       Caption         =   "&Wait Condition"
  206.       ForeColor       =   &H80000008&
  207.       Height          =   375
  208.       Left            =   240
  209.       TabIndex        =   10
  210.       Top             =   2040
  211.       Width           =   1545
  212.    End
  213.    Begin VB.Frame TimeOutFrame 
  214.       Caption         =   "&Time out value"
  215.       Enabled         =   0   'False
  216.       ForeColor       =   &H80000008&
  217.       Height          =   612
  218.       Left            =   312
  219.       TabIndex        =   4
  220.       Top             =   1080
  221.       Width           =   4260
  222.       Begin VB.OptionButton HourOption 
  223.          Caption         =   "hour"
  224.          Enabled         =   0   'False
  225.          ForeColor       =   &H80000008&
  226.          Height          =   255
  227.          Left            =   3432
  228.          TabIndex        =   9
  229.          Top             =   240
  230.          Width           =   720
  231.       End
  232.       Begin VB.OptionButton MinuteOption 
  233.          Caption         =   "minute"
  234.          Enabled         =   0   'False
  235.          ForeColor       =   &H80000008&
  236.          Height          =   255
  237.          Left            =   2568
  238.          TabIndex        =   8
  239.          Top             =   240
  240.          Width           =   930
  241.       End
  242.       Begin VB.OptionButton SecOption 
  243.          Caption         =   "sec"
  244.          Enabled         =   0   'False
  245.          ForeColor       =   &H80000008&
  246.          Height          =   255
  247.          Left            =   1896
  248.          TabIndex        =   7
  249.          Top             =   240
  250.          Width           =   645
  251.       End
  252.       Begin VB.OptionButton MsecOption 
  253.          Caption         =   "msec"
  254.          Enabled         =   0   'False
  255.          ForeColor       =   &H80000008&
  256.          Height          =   255
  257.          Left            =   1128
  258.          TabIndex        =   6
  259.          Top             =   240
  260.          Value           =   -1  'True
  261.          Width           =   870
  262.       End
  263.       Begin VB.TextBox TimeOutText 
  264.          Alignment       =   2  'Center
  265.          BackColor       =   &H00FFFFC0&
  266.          Enabled         =   0   'False
  267.          ForeColor       =   &H00000000&
  268.          Height          =   288
  269.          Left            =   120
  270.          MaxLength       =   6
  271.          TabIndex        =   5
  272.          Text            =   "000000"
  273.          Top             =   240
  274.          Width           =   732
  275.       End
  276.    End
  277.    Begin VB.CheckBox TimeOutCheck 
  278.       Caption         =   "Time &Out"
  279.       ForeColor       =   &H80000008&
  280.       Height          =   252
  281.       Left            =   216
  282.       TabIndex        =   3
  283.       Top             =   720
  284.       Width           =   1164
  285.    End
  286.    Begin VB.TextBox DataText 
  287.       Height          =   372
  288.       Left            =   2280
  289.       TabIndex        =   27
  290.       Text            =   "Text1"
  291.       Top             =   5040
  292.       Visible         =   0   'False
  293.       Width           =   204
  294.    End
  295.    Begin VB.Frame Frame1 
  296.       Caption         =   "Input Parameters"
  297.       Height          =   4812
  298.       Left            =   120
  299.       TabIndex        =   0
  300.       Top             =   120
  301.       Width           =   4692
  302.       Begin VB.Label Label1 
  303.          Caption         =   "Session &Id"
  304.          Height          =   252
  305.          Left            =   120
  306.          TabIndex        =   1
  307.          Top             =   240
  308.          Width           =   972
  309.       End
  310.    End
  311. End
  312. Attribute VB_Name = "FormSessExMacroWait"
  313. Attribute VB_Creatable = False
  314. Attribute VB_Exposed = False
  315.  
  316. Private Sub ChangeCursorPosGroup(Status As Integer)
  317.  
  318.    CursorPosFrame.Enabled = Status
  319.    RowLabel.Enabled = Status
  320.    RowText.Enabled = Status
  321.    ColumnLabel.Enabled = Status
  322.    ColumnText.Enabled = Status
  323. End Sub
  324.  
  325. Private Sub ChangeStringGroup(Status As Integer)
  326.  
  327.    StringFrame.Enabled = Status
  328.    StringText.Enabled = Status
  329. End Sub
  330.  
  331. Private Sub ChangeTimeOutGroup(Status As Integer)
  332.  
  333.    TimeOutFrame.Enabled = Status
  334.    TimeOutText.Enabled = Status
  335.    MsecOption.Enabled = Status
  336.    SecOption.Enabled = Status
  337.    MinuteOption.Enabled = Status
  338.    HourOption.Enabled = Status
  339.  
  340. End Sub
  341.  
  342. Private Sub ChangeWaitConGroup(Status As Integer)
  343.  
  344.    WaitTypeFrame.Enabled = Status
  345.    WhileOption.Enabled = Status
  346.    UntilOption.Enabled = Status
  347.    TrigerTypeFrame.Enabled = Status
  348.    CursorOption.Enabled = Status
  349.    StringOption.Enabled = Status
  350. End Sub
  351.  
  352. Private Sub CursorOption_Click()
  353.  
  354.    DefPSPosCheck.Enabled = False
  355.    ChangeStringGroup (False)
  356.    ChangeCursorPosGroup (True)
  357. End Sub
  358.  
  359. Private Sub DefPSPosCheck_Click()
  360.    If DefPSPosCheck.Value = CHECKED Then
  361.       ChangeCursorPosGroup (True)
  362.    Else
  363.       ChangeCursorPosGroup (False)
  364.    End If
  365. End Sub
  366.  
  367. Private Sub Execute_Click()
  368. On Error GoTo ErrHandler
  369.    FunctionComp = True
  370.    
  371.    OldMousePointer = MousePointer
  372.    MousePointer = 11 ' Hour Glass Mouse Pointer
  373.    
  374.    DisplayType$ = GetDisplayType$(SessionIdList.Text)
  375.    
  376.    If DisplayType$ = "NONE" Then
  377.       MousePointer = OldMousePointer
  378.       MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
  379.       Exit Sub
  380.    End If
  381.    
  382.    temp$ = LTrim$(RTrim$(SessionIdList.Text))
  383.    If Len(temp$) > 0 Then
  384.       Topic$ = "Session" + SessionIdList.Text
  385.    Else
  386.       MousePointer = OldMousePointer
  387.       MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  388.       Exit Sub
  389.    End If
  390.    CommandString$ = GetSessExMacroWaitData()
  391.  
  392.    rc = DoEvents()              'If you use VisualBasic V2.0, call
  393.                                 'DoEvents function each time before
  394.                                 'starting DDE conversation.
  395.    DataText.LinkTimeout = -1
  396.    DataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
  397.    DataText.LinkMode = COLD
  398.    DataText.LinkExecute CommandString$
  399.    DataText.LinkMode = NONE
  400.  
  401.    MousePointer = OldMousePointer
  402.    If FunctionComp = True Then
  403.       MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
  404.       EndStatus$ = MSG_OK
  405.    Else
  406.       MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
  407.       EndStatus$ = MSG_NG
  408.    End If
  409.    TempLogData$ = Time$ + ":Session Execute Macro : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
  410.    TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """""" + Chr$(13) + Chr$(10) + Chr$(9)
  411.    TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
  412.    TempLogData$ = TempLogData$ + "Command = " + """" + CommandString$ + """" + Chr$(13) + Chr$(10)
  413.    LogData$(LogEnd) = TempLogData$
  414.    UpdateLogPointer
  415.    Loged = True
  416.    Exit Sub
  417.  
  418. ErrHandler:
  419.    FunctionComp = False
  420.    Resume Next
  421. End Sub
  422.  
  423. Private Sub ExitDlg_Click()
  424.     Hide
  425. End Sub
  426.  
  427. Private Function GetSessExMacroWaitData() As String
  428.    Dim ReturnString As String
  429.    Dim CursorPos As String
  430.    Dim Status As Integer
  431.    Status = True
  432.  
  433.    If TimeOutCheck.Value = CHECKED Then
  434.       temp$ = RTrim$(LTrim$(TimeOutText.Text))
  435.       If Len(temp$) > 0 Then
  436.          If MsecOption.Value = True Then
  437.             temp$ = temp$ + " msec"
  438.          ElseIf SecOption.Value = True Then
  439.             temp$ = temp$ + " sec"
  440.          ElseIf MinuteOption.Value = True Then
  441.             temp$ = temp$ + " minute"
  442.          Else
  443.             temp$ = temp$ + " hour"
  444.          End If
  445.          ReturnString = temp$
  446.       Else
  447.          Status = False
  448.       End If
  449.    End If
  450.  
  451.    If (Status = True) And WaitConCheck.Value = CHECKED Then
  452.       If WhileOption.Value = True Then
  453.          temp$ = "while "
  454.       Else
  455.          temp$ = "until "
  456.       End If
  457.       
  458.       If DefPSPosCheck.Value = CHECKED Or DefPSPosCheck.Enabled = False Then
  459.          Row$ = RTrim$(LTrim$(RowText.Text))
  460.          Col$ = RTrim$(LTrim$(ColumnText.Text))
  461.          If (Len(Row$) > 0) And (Len(Col$)) > 0 Then
  462.             CursorPos = "(" + Row$ + "," + Col$ + ")"
  463.          Else
  464.             Status = False
  465.          End If
  466.       End If
  467.  
  468.       If Status = True Then
  469.          If (CursorOption.Value = True) Then
  470.             temp$ = temp$ + "cursor at " + CursorPos
  471.          Else
  472.             Triger$ = RTrim$(LTrim$(StringText.Text))
  473.             If Len(Triger$) > 0 Then
  474.                If Left$(Triger$, 1) = """""" Then
  475.                   temp$ = temp$ + Triger$ + " "
  476.                Else
  477.                   temp$ = temp$ + """""" + Triger$ + """""" + " "
  478.                End If
  479.                If DefPSPosCheck.Value = CHECKED Then
  480.                   temp$ = temp$ + "at " + CursorPos
  481.                End If
  482.             Else
  483.                Status = False
  484.             End If
  485.          End If
  486.          If Status = True Then
  487.             ReturnString = ReturnString + " " + temp$
  488.          End If
  489.       End If
  490.    End If
  491.    If Status = True Then
  492.      GetSessExMacroWaitData = "[WAIT(" + """" + ReturnString + """)]"
  493.    End If
  494. End Function
  495.  
  496. Private Sub Form_Load()
  497.   SessionIdList.ListIndex = 0
  498.   AdjustForNT351 FormSessExMacroWait
  499. End Sub
  500.  
  501. Private Sub StringOption_Click()
  502.  
  503.    DefPSPosCheck.Enabled = True
  504.    ChangeStringGroup (True)
  505.    If DefPSPosCheck.Value = CHECKED Then
  506.       ChangeCursorPosGroup (True)
  507.    Else
  508.       ChangeCursorPosGroup (False)
  509.    End If
  510. End Sub
  511.  
  512. Private Sub TimeOutCheck_Click()
  513.  
  514.    If TimeOutCheck.Value = CHECKED Then
  515.       ChangeTimeOutGroup (True)
  516.    Else
  517.       ChangeTimeOutGroup (False)
  518.    End If
  519. End Sub
  520.  
  521. Private Sub UpdateLogPointer()
  522.     LogEnd = LogEnd + 1
  523.     If LogEnd = MAXLOGNUM + 1 Then
  524.        LogEnd = 0
  525.     End If
  526.  
  527.     If LogTop = LogEnd Then
  528.        LogTop = LogTop + 1
  529.        If LogTop = MAXLOGNUM + 1 Then
  530.           LogTop = 0
  531.        End If
  532.     End If
  533. End Sub
  534.  
  535. Private Sub WaitConCheck_Click()
  536.  
  537.    If WaitConCheck.Value = CHECKED Then
  538.       ChangeWaitConGroup (True)
  539.       If CursorOption.Value = True Then
  540.          ChangeCursorPosGroup (True)
  541.       Else
  542.          ChangeStringGroup (True)
  543.          DefPSPosCheck.Enabled = True
  544.          If DefPSPosCheck.Value = CHECKED Then
  545.             ChangeCursorPosGroup (True)
  546.          End If
  547.       End If
  548.    Else
  549.       ChangeWaitConGroup (False)
  550.       ChangeCursorPosGroup (False)
  551.       ChangeStringGroup (False)
  552.       DefPSPosCheck.Enabled = False
  553.    End If
  554. End Sub
  555.  
  556.