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

  1. VERSION 4.00
  2. Begin VB.Form FormGetPS 
  3.    Caption         =   "Get Presentation Space"
  4.    ClientHeight    =   6270
  5.    ClientLeft      =   720
  6.    ClientTop       =   990
  7.    ClientWidth     =   8070
  8.    BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    ForeColor       =   &H80000008&
  18.    Height          =   6675
  19.    Left            =   660
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   6270
  23.    ScaleWidth      =   8070
  24.    Top             =   645
  25.    Width           =   8190
  26.    Begin VB.CommandButton Execute 
  27.       Caption         =   "&Execute"
  28.       Default         =   -1  'True
  29.       Height          =   375
  30.       Left            =   2040
  31.       TabIndex        =   2
  32.       Top             =   5760
  33.       Width           =   975
  34.    End
  35.    Begin VB.CommandButton ExitDlg 
  36.       Cancel          =   -1  'True
  37.       Caption         =   "E&xit"
  38.       Height          =   372
  39.       Left            =   5040
  40.       TabIndex        =   1
  41.       Top             =   5760
  42.       Width           =   972
  43.    End
  44.    Begin VB.TextBox PartialPSDataText 
  45.       BackColor       =   &H00C0FFFF&
  46.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  47.          Name            =   "System"
  48.          Size            =   9.75
  49.          Charset         =   0
  50.          Weight          =   700
  51.          Underline       =   0   'False
  52.          Italic          =   0   'False
  53.          Strikethrough   =   0   'False
  54.       EndProperty
  55.       ForeColor       =   &H00FF0000&
  56.       Height          =   372
  57.       Left            =   3720
  58.       Locked          =   -1  'True
  59.       MultiLine       =   -1  'True
  60.       TabIndex        =   0
  61.       TabStop         =   0   'False
  62.       Top             =   5760
  63.       Visible         =   0   'False
  64.       Width           =   396
  65.    End
  66.    Begin TabDlg.SSTab SSTab1 
  67.       Height          =   5535
  68.       Left            =   120
  69.       TabIndex        =   3
  70.       Top             =   120
  71.       Width           =   7815
  72.       _ExtentX        =   13785
  73.       _ExtentY        =   9763
  74.       _Version        =   393216
  75.       TabHeight       =   423
  76.       TabCaption(0)   =   "Input Parameter"
  77.       Tab(0).ControlEnabled=   -1  'True
  78.       Tab(0).Control(0)=   "Frame1"
  79.       Tab(0).Control(0).Enabled=   0   'False
  80.       Tab(0).ControlCount=   1
  81.       TabCaption(1)   =   "PS Info and Data"
  82.       Tab(1).ControlEnabled=   0   'False
  83.       Tab(1).Control(0)=   "PSDataFrame"
  84.       Tab(1).Control(1)=   "Frame4"
  85.       Tab(1).Control(2)=   "Frame5"
  86.       Tab(1).Control(3)=   "Frame6"
  87.       Tab(1).ControlCount=   4
  88.       TabCaption(2)   =   "Field Info"
  89.       Tab(2).ControlEnabled=   0   'False
  90.       Tab(2).Control(0)=   "Frame8"
  91.       Tab(2).ControlCount=   1
  92.       Begin VB.Frame Frame6 
  93.          Caption         =   "Number of Columns"
  94.          Height          =   612
  95.          Left            =   -71040
  96.          TabIndex        =   31
  97.          Top             =   360
  98.          Width           =   1812
  99.          Begin VB.Label ColumnsLabel 
  100.             Alignment       =   2  'Center
  101.             Height          =   252
  102.             Left            =   120
  103.             TabIndex        =   32
  104.             Top             =   240
  105.             Width           =   1572
  106.          End
  107.       End
  108.       Begin VB.Frame Frame5 
  109.          Caption         =   "Number of Rows"
  110.          Height          =   612
  111.          Left            =   -72960
  112.          TabIndex        =   29
  113.          Top             =   360
  114.          Width           =   1812
  115.          Begin VB.Label RowsLabel 
  116.             Alignment       =   2  'Center
  117.             Height          =   252
  118.             Left            =   120
  119.             TabIndex        =   30
  120.             Top             =   240
  121.             Width           =   1572
  122.          End
  123.       End
  124.       Begin VB.Frame Frame4 
  125.          Caption         =   "Size Of PS"
  126.          Height          =   612
  127.          Left            =   -74880
  128.          TabIndex        =   27
  129.          Top             =   360
  130.          Width           =   1812
  131.          Begin VB.Label LengthLabel 
  132.             Alignment       =   2  'Center
  133.             Height          =   252
  134.             Left            =   120
  135.             TabIndex        =   28
  136.             Top             =   240
  137.             Width           =   1572
  138.          End
  139.       End
  140.       Begin VB.Frame Frame1 
  141.          Caption         =   "Input Parameter"
  142.          Height          =   612
  143.          Left            =   360
  144.          TabIndex        =   24
  145.          Top             =   720
  146.          Width           =   1692
  147.          Begin VB.ComboBox SessionIdList 
  148.             BackColor       =   &H00FFFFC0&
  149.             ForeColor       =   &H00000000&
  150.             Height          =   288
  151.             ItemData        =   "FGETPS.frx":0000
  152.             Left            =   1080
  153.             List            =   "FGETPS.frx":0052
  154.             Sorted          =   -1  'True
  155.             Style           =   2  'Dropdown List
  156.             TabIndex        =   26
  157.             Top             =   240
  158.             Width           =   492
  159.          End
  160.          Begin VB.Label Label2 
  161.             Caption         =   "Session &Id"
  162.             Height          =   252
  163.             Left            =   120
  164.             TabIndex        =   25
  165.             Top             =   240
  166.             Width           =   1092
  167.          End
  168.       End
  169.       Begin VB.Frame PSDataFrame 
  170.          Caption         =   "PS Data"
  171.          Height          =   4212
  172.          Left            =   -74880
  173.          TabIndex        =   22
  174.          Top             =   1080
  175.          Width           =   7572
  176.          Begin VB.TextBox PSDataText 
  177.             BackColor       =   &H00C0FFFF&
  178.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  179.                Name            =   "IBM3270"
  180.                Size            =   10.5
  181.                Charset         =   0
  182.                Weight          =   400
  183.                Underline       =   0   'False
  184.                Italic          =   0   'False
  185.                Strikethrough   =   0   'False
  186.             EndProperty
  187.             Height          =   3852
  188.             Left            =   120
  189.             Locked          =   -1  'True
  190.             MultiLine       =   -1  'True
  191.             ScrollBars      =   3  'Both
  192.             TabIndex        =   23
  193.             Top             =   240
  194.             Width           =   7332
  195.          End
  196.       End
  197.       Begin VB.Frame Frame8 
  198.          Caption         =   "Field Information"
  199.          Height          =   3372
  200.          Left            =   -74040
  201.          TabIndex        =   4
  202.          Top             =   1080
  203.          Width           =   6012
  204.          Begin VB.Frame Frame9 
  205.             Caption         =   "Number of Fields"
  206.             Height          =   612
  207.             Left            =   120
  208.             TabIndex        =   20
  209.             Top             =   240
  210.             Width           =   1812
  211.             Begin VB.Label NumberLabel 
  212.                Alignment       =   2  'Center
  213.                Height          =   252
  214.                Left            =   120
  215.                TabIndex        =   21
  216.                Top             =   240
  217.                Width           =   1572
  218.             End
  219.          End
  220.          Begin VB.Frame Frame10 
  221.             Caption         =   "Fields"
  222.             Height          =   2172
  223.             Left            =   120
  224.             TabIndex        =   5
  225.             Top             =   960
  226.             Width           =   5652
  227.             Begin VB.Frame Frame11 
  228.                Caption         =   "Field Range"
  229.                Height          =   612
  230.                Left            =   120
  231.                TabIndex        =   17
  232.                Top             =   600
  233.                Width           =   1572
  234.                Begin VB.Label FieldRangeLabel 
  235.                   Alignment       =   2  'Center
  236.                   Height          =   252
  237.                   Left            =   120
  238.                   TabIndex        =   18
  239.                   Top             =   240
  240.                   Width           =   1332
  241.                End
  242.             End
  243.             Begin VB.Frame Frame12 
  244.                Caption         =   "Type of Data"
  245.                Height          =   612
  246.                Left            =   1800
  247.                TabIndex        =   15
  248.                Top             =   600
  249.                Width           =   1572
  250.                Begin VB.Label TypeOfDataLabel 
  251.                   Alignment       =   2  'Center
  252.                   Height          =   252
  253.                   Left            =   120
  254.                   TabIndex        =   16
  255.                   Top             =   240
  256.                   Width           =   1332
  257.                End
  258.             End
  259.             Begin VB.Frame Frame13 
  260.                Caption         =   "Intensity"
  261.                Height          =   612
  262.                Left            =   3480
  263.                TabIndex        =   13
  264.                Top             =   600
  265.                Width           =   1572
  266.                Begin VB.Label IntensityLabel 
  267.                   Alignment       =   2  'Center
  268.                   Height          =   252
  269.                   Left            =   120
  270.                   TabIndex        =   14
  271.                   Top             =   240
  272.                   Width           =   1332
  273.                End
  274.             End
  275.             Begin VB.Frame Frame14 
  276.                Caption         =   "Pen Detectable"
  277.                Height          =   612
  278.                Left            =   120
  279.                TabIndex        =   11
  280.                Top             =   1320
  281.                Width           =   1572
  282.                Begin VB.Label PenDectionLabel 
  283.                   Alignment       =   2  'Center
  284.                   Height          =   252
  285.                   Left            =   120
  286.                   TabIndex        =   12
  287.                   Top             =   240
  288.                   Width           =   1332
  289.                End
  290.             End
  291.             Begin VB.Frame Frame15 
  292.                Caption         =   "Is Modified"
  293.                Height          =   612
  294.                Left            =   1800
  295.                TabIndex        =   9
  296.                Top             =   1320
  297.                Width           =   1572
  298.                Begin VB.Label IsModifiedLabel 
  299.                   Alignment       =   2  'Center
  300.                   Height          =   252
  301.                   Left            =   120
  302.                   TabIndex        =   10
  303.                   Top             =   240
  304.                   Width           =   1332
  305.                End
  306.             End
  307.             Begin VB.ComboBox FieldCombo 
  308.                BackColor       =   &H00C0FFFF&
  309.                ForeColor       =   &H00000000&
  310.                Height          =   288
  311.                ItemData        =   "FGETPS.frx":00A4
  312.                Left            =   600
  313.                List            =   "FGETPS.frx":00A6
  314.                Style           =   2  'Dropdown List
  315.                TabIndex        =   8
  316.                Top             =   240
  317.                Width           =   492
  318.             End
  319.             Begin VB.Frame Frame16 
  320.                Caption         =   "Is Protected"
  321.                Height          =   612
  322.                Left            =   3480
  323.                TabIndex        =   6
  324.                Top             =   1320
  325.                Width           =   1572
  326.                Begin VB.Label IsProtectedLabel 
  327.                   Alignment       =   2  'Center
  328.                   Height          =   252
  329.                   Left            =   120
  330.                   TabIndex        =   7
  331.                   Top             =   240
  332.                   Width           =   1332
  333.                End
  334.             End
  335.             Begin VB.Label Label8 
  336.                Caption         =   "Field"
  337.                Height          =   252
  338.                Left            =   120
  339.                TabIndex        =   19
  340.                Top             =   240
  341.                Width           =   492
  342.             End
  343.          End
  344.       End
  345.    End
  346. End
  347. Attribute VB_Name = "FormGetPS"
  348. Attribute VB_Creatable = False
  349. Attribute VB_Exposed = False
  350.  ' Should dynamically base these off of the number of fields.
  351.  Dim FieldStarts(0 To 1000) As String
  352.  Dim FieldLengths(0 To 1000) As String
  353.  Dim FieldAttributes(0 To 1000) As String
  354.   
  355.   Dim MainMinimumWidth As Long
  356.   Dim MainMinimumHeight As Long
  357.  
  358.   Dim PSDataTextWidth As Long
  359.   Dim PSDataTextHeight As Long
  360.  
  361.   Dim PSDataFrameWidth As Long
  362.   Dim PSDataFrameHeight As Long
  363.  
  364.   Dim ExecuteTop As Long
  365.   Dim ExecuteLeft As Long
  366.  
  367.   Dim ExitDlgTop As Long
  368.   Dim ExitDlgLeft As Long
  369.  
  370. Private Sub Execute_Click()
  371. On Error GoTo ErrHandler
  372.    FunctionComp = True
  373.    
  374.    OldMousePointer = MousePointer
  375.    MousePointer = 11 ' Hour Glass Mouse Pointer
  376.  
  377.    DisplayType$ = GetDisplayType$(SessionIdList.Text)
  378.    
  379.    If DisplayType$ = "NONE" Then
  380.       MousePointer = OldMousePointer
  381.       MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
  382.       Exit Sub
  383.    End If
  384.  
  385.    temp$ = LTrim$(RTrim$(SessionIdList.Text))
  386.    If Len(temp$) > 0 Then
  387.       Topic$ = "Session" + temp$
  388.    Else
  389.       MousePointer = OldMousePointer
  390.       MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  391.       Exit Sub
  392.    End If
  393.    Item$ = "PS"
  394.  
  395.    rc = DoEvents()              'If you use VisualBasic V2.0, call
  396.                                 'DoEvents function each time before
  397.                                 'starting DDE conversation.
  398.  
  399.    PartialPSDataText.LinkTimeout = -1
  400.    PartialPSDataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
  401.    PartialPSDataText.LinkMode = COLD
  402.    PartialPSDataText.LinkItem = Item$
  403.    PartialPSDataText.LinkRequest
  404.    PartialPSDataText.LinkMode = NONE
  405.    
  406.    MousePointer = OldMousePointer
  407.    If FunctionComp = True Then
  408.       GetPSInfo
  409.       If CInt(NumberLabel.Caption) <> 0 Then
  410.         FieldCombo.ListIndex = 0
  411.       End If
  412.       SSTab1.Tab = 1
  413.       MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
  414.       EndStatus$ = MSG_OK
  415.    Else
  416.       MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
  417.       EndStatus$ = MSG_NG
  418.    End If
  419.    TempLogData$ = Time$ + ":Get PS : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
  420.    TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
  421.    TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
  422.    TempLogData$ = TempLogData$ + MSG_ITEM + """" + Item$ + """" + Chr$(13) + Chr$(10)
  423.    LogData$(LogEnd) = TempLogData$
  424.    UpdateLogPointer
  425.    Loged = True
  426.    Exit Sub
  427.  
  428. ErrHandler:
  429.    FunctionComp = False
  430.    Resume Next
  431. End Sub
  432.  
  433. Private Sub ExitDlg_Click()
  434.     Hide
  435. End Sub
  436.  
  437. Private Sub UpdateLogPointer()
  438.     LogEnd = LogEnd + 1
  439.     If LogEnd = MAXLOGNUM + 1 Then
  440.        LogEnd = 0
  441.     End If
  442.  
  443.     If LogTop = LogEnd Then
  444.        LogTop = LogTop + 1
  445.        If LogTop = MAXLOGNUM + 1 Then
  446.           LogTop = 0
  447.        End If
  448.     End If
  449. End Sub
  450.  
  451. Private Sub FieldCombo_Click()
  452.  Dim FieldAttribute As Byte
  453.  Dim StartOfField As Integer
  454.  Dim length As Integer
  455.  Dim EndOfField As Integer
  456.  
  457.  StartOfField = FieldStarts(FieldCombo.Text)
  458.  length = FieldLengths(FieldCombo.Text)
  459.  EndOfField = StartOfField + length - 1
  460.  'MFWU change Asc to be AscB
  461.  FieldAttribute = AscB(FieldAttributes(FieldCombo.Text))
  462.   
  463.  FieldRangeLabel.Caption = StartOfField & "-" & EndOfField
  464.   
  465.   If FieldAttribute And &H10& Then
  466.    TypeOfDataLabel.Caption = "Numeric"
  467.  Else
  468.    TypeOfDataLabel.Caption = "AlphaNumeric"
  469.  End If
  470.  
  471.  If FieldAttribute And &H20& Then
  472.    IsProtectedLabel.Caption = "Yes"
  473.  Else
  474.    IsProtectedLabel.Caption = "No"
  475.  End If
  476.  
  477.  If ((FieldAttribute And &HC&) = &H0&) Then
  478.    IntensityLabel.Caption = "Normal"
  479.    PenDectionLabel.Caption = "No"
  480.  ElseIf ((FieldAttribute And &HC&) = &H4&) Then
  481.    IntensityLabel.Caption = "Normal"
  482.    PenDectionLabel.Caption = "Yes"
  483.  ElseIf ((FieldAttribute And &HC&) = &H8&) Then
  484.    IntensityLabel.Caption = "High"
  485.    PenDectionLabel.Caption = "Yes"
  486.  Else
  487.    IntensityLabel.Caption = "Non-Display"
  488.    PenDectionLabel.Caption = "No"
  489.  End If
  490.  
  491.  If FieldAttribute And &H1& Then
  492.    IsModifiedLabel.Caption = "Yes"
  493.  Else
  494.    IsModifiedLabel.Caption = "No"
  495.  End If
  496.  
  497. End Sub
  498.  
  499.  
  500. Private Sub Form_Load()
  501.   SessionIdList.ListIndex = 0
  502.   
  503.   MainMinimumWidth = Width
  504.   MainMinimumHeight = Height
  505.  
  506.   PSDataTextWidth = PSDataText.Width
  507.   PSDataTextHeight = PSDataText.Height
  508.  
  509.   PSDataFrameWidth = PSDataFrame.Width
  510.   PSDataFrameHeight = PSDataFrame.Height
  511.  
  512.   ExecuteTop = Execute.Top
  513.   ExecuteLeft = Execute.Left
  514.  
  515.   ExitDlgTop = ExitDlg.Top
  516.   ExitDlgLeft = ExitDlg.Left
  517.  
  518. End Sub
  519.  
  520.  
  521. Private Sub Form_Resize()
  522.   If WindowState = 1 Then ' Iconic
  523.     Exit Sub
  524.   End If
  525.  
  526.   If (Width < MainMinimumWidth) Then
  527.     Width = MainMinimumWidth
  528.   End If
  529.  
  530.   If (Height < MainMinimumHeight) Then
  531.     Height = MainMinimumHeight
  532.   End If
  533.   
  534.   WidthDelta = Width - MainMinimumWidth
  535.   HeightDelta = Height - MainMinimumHeight
  536.  
  537.   PSDataText.Width = PSDataTextWidth + WidthDelta
  538.   PSDataText.Height = PSDataTextHeight + HeightDelta
  539.  
  540.   PSDataFrame.Width = PSDataFrameWidth + WidthDelta
  541.   PSDataFrame.Height = PSDataFrameHeight + HeightDelta
  542.  
  543.   Execute.Top = ExecuteTop + HeightDelta
  544.   Execute.Left = ExecuteLeft + (WidthDelta / 2)
  545.  
  546.   ExitDlg.Top = ExitDlgTop + HeightDelta
  547.   ExitDlg.Left = ExitDlgLeft + (WidthDelta / 2)
  548.  
  549.   Refresh
  550. End Sub
  551.  
  552.  
  553.  
  554. Private Sub GetPSInfo()
  555.   Dim BeginPosition As Integer
  556.   Dim EndPosition As Integer
  557.   
  558.   BeginPosition = 1
  559.   EndPosition = InStr(BeginPosition, PartialPSDataText.Text, Chr$(9))
  560.   LengthLabel.Caption = Mid(PartialPSDataText.Text, BeginPosition, EndPosition - BeginPosition)
  561.   
  562.   BeginPosition = EndPosition + 1
  563.   EndPosition = InStr(BeginPosition, PartialPSDataText.Text, Chr$(9))
  564.   RowsLabel.Caption = Mid(PartialPSDataText.Text, BeginPosition, EndPosition - BeginPosition)
  565.   
  566.   BeginPosition = EndPosition + 1
  567.   EndPosition = InStr(BeginPosition, PartialPSDataText.Text, Chr$(9))
  568.   ColumnsLabel.Caption = Mid(PartialPSDataText.Text, BeginPosition, EndPosition - BeginPosition)
  569.   
  570.   BeginPosition = EndPosition + 1
  571.   PSDataText.Text = Mid(PartialPSDataText.Text, BeginPosition, CInt(LengthLabel.Caption))
  572.   
  573.   BeginPosition = BeginPosition + CInt(LengthLabel.Caption) + 1 + 2 * (CInt(RowsLabel.Caption) - 1)
  574.                         ' +1 for Tab Character and + 1 for each newline character between each row
  575.   EndPosition = InStr(BeginPosition, PartialPSDataText.Text, Chr$(9))
  576.   NumberLabel.Caption = Mid(PartialPSDataText.Text, BeginPosition, EndPosition - BeginPosition)
  577.   
  578.   FieldCombo.Clear
  579.   FieldRangeLabel.Caption = ""
  580.   TypeOfDataLabel.Caption = ""
  581.   IntensityLabel.Caption = ""
  582.   PenDectionLabel.Caption = ""
  583.   IsModifiedLabel.Caption = ""
  584.   
  585.   If CInt(NumberLabel.Caption) <> 0 Then
  586.   For Counter = 1 To CInt(NumberLabel.Caption)
  587.     ' Field Start
  588.     BeginPosition = EndPosition + 1
  589.     BeginFieldPosition = BeginPosition
  590.     EndPosition = InStr(BeginPosition, PartialPSDataText.Text, Chr$(9))
  591.     FieldStarts(Counter) = Mid(PartialPSDataText.Text, BeginPosition, EndPosition - BeginPosition)
  592.     
  593.     ' Field Length
  594.     BeginPosition = EndPosition + 1
  595.     EndPosition = InStr(BeginPosition, PartialPSDataText.Text, Chr$(9))
  596.     FieldLengths(Counter) = Mid(PartialPSDataText.Text, BeginPosition, EndPosition - BeginPosition)
  597.     
  598.     ' Field Attribute
  599.     BeginPosition = EndPosition + 1
  600.     'MFWU change the following line.
  601.     'EndPosition = InStr(BeginPosition, PartialPSDataText.Text, Chr$(9))
  602.     EndPosition = BeginPosition + 1
  603. If EndPosition = 0 Then
  604.   MsgBox "EndPostion is 0"
  605. End If
  606.     'MFWU change Mid to be MidB
  607.     FieldAttributes(Counter) = MidB(PartialPSDataText.Text, BeginPosition, EndPosition - BeginPosition)
  608.     
  609.     FieldCombo.AddItem Counter
  610.   Next Counter
  611.   End If
  612. End Sub
  613.  
  614. Private Sub TabStrip1_Click(Index As Integer)
  615.  
  616. End Sub
  617.  
  618.  
  619.