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

  1. VERSION 4.00
  2. Begin VB.Form FormGetSessStatus 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Get Session Status"
  5.    ClientHeight    =   5268
  6.    ClientLeft      =   3468
  7.    ClientTop       =   2496
  8.    ClientWidth     =   5304
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   0
  12.       weight          =   700
  13.       size            =   7.8
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    ForeColor       =   &H80000008&
  19.    Height          =   5592
  20.    Left            =   3420
  21.    LinkMode        =   1  'Source
  22.    LinkTopic       =   "Form1"
  23.    MaxButton       =   0   'False
  24.    MinButton       =   0   'False
  25.    ScaleHeight     =   5268
  26.    ScaleWidth      =   5304
  27.    ShowInTaskbar   =   0   'False
  28.    Top             =   2220
  29.    Width           =   5400
  30.    Begin VB.Frame Frame9 
  31.       Caption         =   "PS Status"
  32.       ForeColor       =   &H80000008&
  33.       Height          =   612
  34.       Left            =   240
  35.       TabIndex        =   30
  36.       Top             =   1080
  37.       Width           =   1332
  38.       Begin VB.Label PSStatusLabel 
  39.          ForeColor       =   &H80000008&
  40.          Height          =   252
  41.          Left            =   120
  42.          TabIndex        =   31
  43.          Top             =   240
  44.          Width           =   1068
  45.       End
  46.    End
  47.    Begin VB.ComboBox SessionIdList 
  48.       BackColor       =   &H00FFFFC0&
  49.       ForeColor       =   &H00000000&
  50.       Height          =   288
  51.       ItemData        =   "FGSESSTD.frx":0000
  52.       Left            =   1200
  53.       List            =   "FGSESSTD.frx":0052
  54.       Sorted          =   -1  'True
  55.       Style           =   2  'Dropdown List
  56.       TabIndex        =   0
  57.       Top             =   360
  58.       Width           =   492
  59.    End
  60.    Begin VB.TextBox SessStatDataText 
  61.       Height          =   372
  62.       Left            =   2520
  63.       TabIndex        =   26
  64.       Top             =   4800
  65.       Visible         =   0   'False
  66.       Width           =   204
  67.    End
  68.    Begin VB.CommandButton ExitDlg 
  69.       Cancel          =   -1  'True
  70.       Caption         =   "E&xit"
  71.       Height          =   372
  72.       Left            =   3240
  73.       TabIndex        =   25
  74.       Top             =   4800
  75.       Width           =   972
  76.    End
  77.    Begin VB.CommandButton Execute 
  78.       Caption         =   "&Execute"
  79.       Default         =   -1  'True
  80.       Height          =   375
  81.       Left            =   1080
  82.       TabIndex        =   24
  83.       Top             =   4800
  84.       Width           =   975
  85.    End
  86.    Begin VB.Frame Frame4 
  87.       Caption         =   "TrimRect Status"
  88.       ForeColor       =   &H80000008&
  89.       Height          =   1692
  90.       Left            =   240
  91.       TabIndex        =   13
  92.       Top             =   2880
  93.       Width           =   4812
  94.       Begin VB.Frame Frame6 
  95.          Caption         =   "Lower right corner"
  96.          ForeColor       =   &H80000008&
  97.          Height          =   612
  98.          Left            =   1680
  99.          TabIndex        =   19
  100.          Top             =   960
  101.          Width           =   3012
  102.          Begin VB.Label TrimLRRowLabel 
  103.             ForeColor       =   &H80000008&
  104.             Height          =   252
  105.             Left            =   2160
  106.             TabIndex        =   22
  107.             Top             =   240
  108.             Width           =   396
  109.          End
  110.          Begin VB.Label Label13 
  111.             Caption         =   "Y Coord"
  112.             ForeColor       =   &H80000008&
  113.             Height          =   252
  114.             Left            =   1416
  115.             TabIndex        =   21
  116.             Top             =   240
  117.             Width           =   756
  118.          End
  119.          Begin VB.Label TrimLRColumnLabel 
  120.             ForeColor       =   &H80000008&
  121.             Height          =   252
  122.             Left            =   840
  123.             TabIndex        =   23
  124.             Top             =   240
  125.             Width           =   396
  126.          End
  127.          Begin VB.Label Label12 
  128.             Caption         =   "X Coord"
  129.             ForeColor       =   &H80000008&
  130.             Height          =   252
  131.             Left            =   96
  132.             TabIndex        =   20
  133.             Top             =   240
  134.             Width           =   756
  135.          End
  136.       End
  137.       Begin VB.Frame Frame5 
  138.          Caption         =   "Top left corner"
  139.          ForeColor       =   &H80000008&
  140.          Height          =   612
  141.          Left            =   1680
  142.          TabIndex        =   14
  143.          Top             =   240
  144.          Width           =   3012
  145.          Begin VB.Label TrimTLRowLabel 
  146.             ForeColor       =   &H80000008&
  147.             Height          =   252
  148.             Left            =   2280
  149.             TabIndex        =   17
  150.             Top             =   240
  151.             Width           =   396
  152.          End
  153.          Begin VB.Label Label9 
  154.             Caption         =   "Y Coord"
  155.             ForeColor       =   &H80000008&
  156.             Height          =   252
  157.             Left            =   1440
  158.             TabIndex        =   16
  159.             Top             =   240
  160.             Width           =   732
  161.          End
  162.          Begin VB.Label TrimTLColumnLabel 
  163.             ForeColor       =   &H80000008&
  164.             Height          =   252
  165.             Left            =   840
  166.             TabIndex        =   18
  167.             Top             =   240
  168.             Width           =   396
  169.          End
  170.          Begin VB.Label Label8 
  171.             Caption         =   "X Coord"
  172.             ForeColor       =   &H80000008&
  173.             Height          =   252
  174.             Left            =   96
  175.             TabIndex        =   15
  176.             Top             =   240
  177.             Width           =   756
  178.          End
  179.       End
  180.       Begin VB.Frame Frame10 
  181.          Caption         =   "Status"
  182.          Height          =   612
  183.          Left            =   120
  184.          TabIndex        =   32
  185.          Top             =   240
  186.          Width           =   1452
  187.          Begin VB.Label TrimStatusLabel 
  188.             Height          =   252
  189.             Left            =   120
  190.             TabIndex        =   33
  191.             Top             =   240
  192.             Width           =   1212
  193.          End
  194.       End
  195.    End
  196.    Begin VB.Frame Frame2 
  197.       Caption         =   "PS Dimensions"
  198.       ForeColor       =   &H80000008&
  199.       Height          =   972
  200.       Left            =   2280
  201.       TabIndex        =   3
  202.       Top             =   1800
  203.       Width           =   1932
  204.       Begin VB.Label PSRowLabel 
  205.          ForeColor       =   &H80000008&
  206.          Height          =   252
  207.          Left            =   768
  208.          TabIndex        =   6
  209.          Top             =   600
  210.          Width           =   1068
  211.       End
  212.       Begin VB.Label Label6 
  213.          Caption         =   "Height"
  214.          ForeColor       =   &H80000008&
  215.          Height          =   252
  216.          Left            =   96
  217.          TabIndex        =   5
  218.          Top             =   600
  219.          Width           =   696
  220.       End
  221.       Begin VB.Label PSColumnLabel 
  222.          ForeColor       =   &H80000008&
  223.          Height          =   252
  224.          Left            =   768
  225.          TabIndex        =   7
  226.          Top             =   240
  227.          Width           =   1068
  228.       End
  229.       Begin VB.Label Label5 
  230.          Caption         =   "Width"
  231.          ForeColor       =   &H80000008&
  232.          Height          =   252
  233.          Left            =   96
  234.          TabIndex        =   4
  235.          Top             =   240
  236.          Width           =   696
  237.       End
  238.    End
  239.    Begin VB.Frame Frame3 
  240.       Caption         =   "Cursor Position"
  241.       ForeColor       =   &H80000008&
  242.       Height          =   972
  243.       Left            =   240
  244.       TabIndex        =   8
  245.       Top             =   1800
  246.       Width           =   1932
  247.       Begin VB.Label CursorRowLabel 
  248.          ForeColor       =   &H80000008&
  249.          Height          =   252
  250.          Left            =   960
  251.          TabIndex        =   11
  252.          Top             =   600
  253.          Width           =   852
  254.       End
  255.       Begin VB.Label Label11 
  256.          Caption         =   "Y Coord"
  257.          ForeColor       =   &H80000008&
  258.          Height          =   252
  259.          Left            =   96
  260.          TabIndex        =   10
  261.          Top             =   600
  262.          Width           =   876
  263.       End
  264.       Begin VB.Label CursorColumnLabel 
  265.          ForeColor       =   &H80000008&
  266.          Height          =   252
  267.          Left            =   960
  268.          TabIndex        =   12
  269.          Top             =   240
  270.          Width           =   852
  271.       End
  272.       Begin VB.Label Label10 
  273.          Caption         =   "X Coord"
  274.          ForeColor       =   &H80000008&
  275.          Height          =   252
  276.          Left            =   96
  277.          TabIndex        =   9
  278.          Top             =   240
  279.          Width           =   876
  280.       End
  281.    End
  282.    Begin VB.Frame Frame1 
  283.       Caption         =   "Window Status"
  284.       ForeColor       =   &H80000008&
  285.       Height          =   612
  286.       Left            =   1680
  287.       TabIndex        =   1
  288.       Top             =   1080
  289.       Width           =   1452
  290.       Begin VB.Label StatusLabel 
  291.          ForeColor       =   &H80000008&
  292.          Height          =   252
  293.          Left            =   120
  294.          TabIndex        =   2
  295.          Top             =   240
  296.          Width           =   972
  297.       End
  298.    End
  299.    Begin VB.Frame Frame7 
  300.       Caption         =   "Input Parameters"
  301.       Height          =   612
  302.       Left            =   120
  303.       TabIndex        =   27
  304.       Top             =   120
  305.       Width           =   1692
  306.       Begin VB.Label Label14 
  307.          Caption         =   "Session &Id"
  308.          Height          =   252
  309.          Left            =   120
  310.          TabIndex        =   28
  311.          Top             =   240
  312.          Width           =   972
  313.       End
  314.    End
  315.    Begin VB.Frame Frame8 
  316.       Caption         =   "Session Status"
  317.       Height          =   3852
  318.       Left            =   120
  319.       TabIndex        =   29
  320.       Top             =   840
  321.       Width           =   5052
  322.       Begin VB.Frame Frame11 
  323.          Caption         =   "Usage"
  324.          Height          =   612
  325.          Left            =   3120
  326.          TabIndex        =   34
  327.          Top             =   240
  328.          Width           =   972
  329.          Begin VB.Label UsageLabel 
  330.             Height          =   252
  331.             Left            =   120
  332.             TabIndex        =   35
  333.             Top             =   240
  334.             Width           =   732
  335.          End
  336.       End
  337.    End
  338. End
  339. Attribute VB_Name = "FormGetSessStatus"
  340. Attribute VB_Creatable = False
  341. Attribute VB_Exposed = False
  342.  
  343.  
  344. Private Function DisplaySessStat() As Integer
  345. On Error GoTo ErrorHandler
  346.    Dim Status As Integer
  347.    Status = True
  348.  
  349.    StartPos& = 1
  350.    EndPos& = 1
  351.    StringLength& = Len(SessStatDataText.Text)
  352.    For i% = 0 To 11
  353.       EndPos& = InStr(StartPos&, SessStatDataText.Text, Chr$(9))
  354.       TempData$(i%) = LTrim$(RTrim$(Mid$(SessStatDataText.Text, StartPos&, EndPos& - StartPos&)))
  355.       StartPos& = EndPos& + 1
  356.    Next i%
  357.    TempData$(12) = Mid$(SessStatDataText.Text, StartPos&, StringLength&)
  358.    
  359.    If Status = True Then
  360.       StatusLabel.Caption = TempData$(0)
  361.       UsageLabel.Caption = TempData$(1)
  362.       PSColumnLabel.Caption = TempData$(2)
  363.       PSRowLabel.Caption = TempData$(3)
  364.       CursorColumnLabel.Caption = TempData$(4)
  365.       CursorRowLabel.Caption = TempData$(5)
  366.       TrimStatusLabel.Caption = TempData$(6)
  367.       TrimTLColumnLabel.Caption = TempData$(7)
  368.       TrimTLRowLabel.Caption = TempData$(8)
  369.       TrimLRColumnLabel.Caption = TempData$(9)
  370.       TrimLRRowLabel.Caption = TempData$(10)
  371.  
  372.       If TempData$(11) = "0" Then
  373.          PSStatusLabel.Caption = "Unlocked"
  374.       ElseIf TempData$(11) = "4" Then
  375.          PSStatusLabel.Caption = "Busy"
  376.       ElseIf TempData$(11) = "5" Then
  377.          PSStatusLabel.Caption = "Locked"
  378.       Else
  379.          Status = False
  380.       End If
  381.    End If
  382.    DisplaySessStat = Status
  383.    Exit Function
  384.  
  385. ErrorHandler:
  386.    dummy% = DoEvents()
  387.    Status = False
  388.    Resume Next
  389. End Function
  390.  
  391. Private Sub Execute_Click()
  392. On Error GoTo ErrHandler
  393.    FunctionComp = True
  394.    
  395.    OldMousePointer = MousePointer
  396.    MousePointer = 11 ' Hour Glass Mouse Pointer
  397.  
  398.    DisplayType$ = GetDisplayType$(SessionIdList.Text)
  399.    
  400.    If DisplayType$ = "NONE" Then
  401.       MousePointer = OldMousePointer
  402.       MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
  403.       Exit Sub
  404.    End If
  405.  
  406.    temp$ = LTrim$(RTrim$(SessionIdList.Text))
  407.    If Len(temp$) > 0 Then
  408.       Topic$ = "Session" + temp$
  409.    Else
  410.       MousePointer = OldMousePointer
  411.       MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  412.       Exit Sub
  413.    End If
  414.    Item$ = "SSTAT"
  415.    
  416.    rc = DoEvents()              'If you use VisualBasic V2.0, call
  417.                                 'DoEvents function each time before
  418.                                 'starting DDE conversation.
  419.    SessStatDataText.LinkTimeout = -1
  420.    SessStatDataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
  421.    SessStatDataText.LinkMode = COLD
  422.    SessStatDataText.LinkItem = Item$
  423.    SessStatDataText.LinkRequest
  424.    SessStatDataText.LinkMode = NONE
  425.  
  426.    MousePointer = OldMousePointer
  427.    If FunctionComp = True Then
  428.       If DisplaySessStat() = True Then
  429.          MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
  430.          EndStatus$ = MSG_OK
  431.       Else
  432.          MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  433.          EndStatus$ = MSG_NG
  434.       End If
  435.    Else
  436.       MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
  437.       EndStatus$ = MSG_NG
  438.    End If
  439.    TempLogData$ = Time$ + ":Get Session Status : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
  440.    TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
  441.    TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
  442.    TempLogData$ = TempLogData$ + MSG_ITEM + """" + Item$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
  443.    TempLogData$ = TempLogData$ + "Data =" + """" + SessStatDataText.Text + """" + Chr$(13) + Chr$(10)
  444.    LogData$(LogEnd) = TempLogData$
  445.    UpdateLogPointer
  446.    Loged = True
  447.    Exit Sub
  448.  
  449. ErrHandler:
  450.    FunctionComp = False
  451.    Resume Next
  452. End Sub
  453.  
  454. Private Sub ExitDlg_Click()
  455.     Hide
  456. End Sub
  457.  
  458. Private Sub UpdateLogPointer()
  459.     LogEnd = LogEnd + 1
  460.     If LogEnd = MAXLOGNUM + 1 Then
  461.        LogEnd = 0
  462.     End If
  463.  
  464.     If LogTop = LogEnd Then
  465.        LogTop = LogTop + 1
  466.        If LogTop = MAXLOGNUM + 1 Then
  467.           LogTop = 0
  468.        End If
  469.     End If
  470. End Sub
  471.  
  472. Private Sub Form_Load()
  473.   SessionIdList.ListIndex = 0
  474. End Sub
  475.  
  476.  
  477.