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

  1. VERSION 4.00
  2. Begin VB.Form FormGetSysConfiguration 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Get System Configuration"
  5.    ClientHeight    =   3264
  6.    ClientLeft      =   3648
  7.    ClientTop       =   3240
  8.    ClientWidth     =   3612
  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          =   3588
  20.    Left            =   3600
  21.    LinkMode        =   1  'Source
  22.    LinkTopic       =   "Form2"
  23.    MaxButton       =   0   'False
  24.    MinButton       =   0   'False
  25.    ScaleHeight     =   3264
  26.    ScaleWidth      =   3612
  27.    ShowInTaskbar   =   0   'False
  28.    Top             =   2964
  29.    Width           =   3708
  30.    Begin VB.TextBox ConfigurationDataText 
  31.       Height          =   372
  32.       Left            =   2760
  33.       TabIndex        =   1
  34.       Top             =   2760
  35.       Visible         =   0   'False
  36.       Width           =   204
  37.    End
  38.    Begin VB.CommandButton ExitDlg 
  39.       Cancel          =   -1  'True
  40.       Caption         =   "&OK"
  41.       Default         =   -1  'True
  42.       Height          =   372
  43.       Left            =   1320
  44.       TabIndex        =   2
  45.       Top             =   2760
  46.       Width           =   972
  47.    End
  48.    Begin VB.Frame Frame1 
  49.       Caption         =   "System Configuration Information"
  50.       Height          =   2412
  51.       Left            =   120
  52.       TabIndex        =   0
  53.       Top             =   120
  54.       Width           =   3372
  55.       Begin VB.Label Label2 
  56.          Caption         =   "Version:"
  57.          ForeColor       =   &H80000008&
  58.          Height          =   252
  59.          Left            =   120
  60.          TabIndex        =   14
  61.          Top             =   240
  62.          Width           =   972
  63.       End
  64.       Begin VB.Label Version 
  65.          ForeColor       =   &H80000008&
  66.          Height          =   252
  67.          Left            =   2040
  68.          TabIndex        =   13
  69.          Top             =   240
  70.          Width           =   1212
  71.       End
  72.       Begin VB.Label Label3 
  73.          Caption         =   "Level:"
  74.          ForeColor       =   &H80000008&
  75.          Height          =   252
  76.          Left            =   120
  77.          TabIndex        =   12
  78.          Top             =   600
  79.          Width           =   972
  80.       End
  81.       Begin VB.Label Level 
  82.          ForeColor       =   &H80000008&
  83.          Height          =   252
  84.          Left            =   2040
  85.          TabIndex        =   11
  86.          Top             =   600
  87.          Width           =   1212
  88.       End
  89.       Begin VB.Label Label4 
  90.          Caption         =   "Date:"
  91.          ForeColor       =   &H80000008&
  92.          Height          =   252
  93.          Left            =   120
  94.          TabIndex        =   10
  95.          Top             =   960
  96.          Width           =   972
  97.       End
  98.       Begin VB.Label DateLog 
  99.          ForeColor       =   &H80000008&
  100.          Height          =   252
  101.          Left            =   2040
  102.          TabIndex        =   9
  103.          Top             =   960
  104.          Width           =   1212
  105.       End
  106.       Begin VB.Label Label5 
  107.          Caption         =   "SysModel Number:"
  108.          ForeColor       =   &H80000008&
  109.          Height          =   252
  110.          Left            =   120
  111.          TabIndex        =   8
  112.          Top             =   1320
  113.          Width           =   1692
  114.       End
  115.       Begin VB.Label SysModel 
  116.          ForeColor       =   &H80000008&
  117.          Height          =   252
  118.          Left            =   2040
  119.          TabIndex        =   7
  120.          Top             =   1320
  121.          Width           =   1212
  122.       End
  123.       Begin VB.Label Label6 
  124.          Caption         =   "Monitor Type:"
  125.          ForeColor       =   &H80000008&
  126.          Height          =   252
  127.          Left            =   120
  128.          TabIndex        =   6
  129.          Top             =   1680
  130.          Width           =   1332
  131.       End
  132.       Begin VB.Label Moniter 
  133.          ForeColor       =   &H80000008&
  134.          Height          =   252
  135.          Left            =   2040
  136.          TabIndex        =   5
  137.          Top             =   1680
  138.          Width           =   1212
  139.       End
  140.       Begin VB.Label Label7 
  141.          Caption         =   "Country Code:"
  142.          ForeColor       =   &H80000008&
  143.          Height          =   252
  144.          Left            =   120
  145.          TabIndex        =   4
  146.          Top             =   2040
  147.          Width           =   1212
  148.       End
  149.       Begin VB.Label Country 
  150.          ForeColor       =   &H80000008&
  151.          Height          =   252
  152.          Left            =   2040
  153.          TabIndex        =   3
  154.          Top             =   2040
  155.          Width           =   1212
  156.       End
  157.    End
  158. End
  159. Attribute VB_Name = "FormGetSysConfiguration"
  160. Attribute VB_Creatable = False
  161. Attribute VB_Exposed = False
  162.  
  163. Private Function DisplaySystemStatus() As Integer
  164. On Error GoTo ErrorHandler
  165.    Dim Status As Integer
  166.    Status = True
  167.  
  168.    StartPos& = 1
  169.    EndPos& = 1
  170.    StringLength& = Len(ConfigurationDataText.Text)
  171.    For i% = 0 To 4
  172.       EndPos& = InStr(StartPos&, ConfigurationDataText.Text, Chr$(9))
  173.       If (EndPos& = StartPos&) Or (EndPos& = 0) Then
  174.          Status = False
  175.          Exit For
  176.       End If
  177.       TempData(i%) = Mid$(ConfigurationDataText.Text, StartPos&, EndPos& - StartPos&)
  178.       StartPos& = EndPos& + 1
  179.    Next i%
  180.  
  181.    If (Status = True) And (StringLength& > StartPos&) Then
  182.       TempData(5) = Mid$(ConfigurationDataText.Text, StartPos&, StringLength&)
  183.       Version.Caption = TempData(0)
  184.       Level.Caption = TempData(1)
  185.       DateLog.Caption = TempData(2)
  186.       SysModel.Caption = TempData(3)
  187.       Moniter.Caption = TempData(4)
  188.       Country.Caption = TempData(5)
  189.    End If
  190.    DisplaySystemStatus = Status
  191.    Exit Function
  192.  
  193. ErrorHandler:
  194.    dummy% = DoEvents()
  195.    Status = False
  196.    Resume Next
  197. End Function
  198.  
  199. Private Sub Execute_Click()
  200. On Error GoTo ErrHandler
  201.    FunctionComp = True
  202.  
  203.    rc = DoEvents()              'If you use VisualBasic V2.0, call
  204.                                 'DoEvents function each time before
  205.                                 'starting DDE conversation.
  206.    ConfigurationDataText.LinkTimeout = -1
  207.    ConfigurationDataText.LinkTopic = "IBM327032|System"
  208.    ConfigurationDataText.LinkMode = COLD
  209.    ConfigurationDataText.LinkItem = "SysCon"
  210.    ConfigurationDataText.LinkRequest
  211.    ConfigurationDataText.LinkMode = NONE
  212.    If FunctionComp = True Then
  213.       If DisplaySystemStatus() = True Then
  214.          MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
  215.          EndStatus$ = MSG_OK
  216.       Else
  217.          MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  218.          EndStatus$ = MSG_NG
  219.       End If
  220.    Else
  221.       MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
  222.       EndStatus$ = MSG_NG
  223.    End If
  224.    TempLogData$ = Time$ + ":Get System Configuration : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
  225.    TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
  226.    TempLogData$ = TempLogData$ + MSG_TOPIC + """System""" + Chr$(13) + Chr$(10) + Chr$(9)
  227.    TempLogData$ = TempLogData$ + MSG_ITEM + """SysCon""" + Chr$(13) + Chr$(10) + Chr$(9)
  228.    TempLogData$ = TempLogData$ + "Data =" + """" + ConfigurationDataText.Text + """" + Chr$(13) + Chr$(10)
  229.    LogData$(LogEnd) = TempLogData$
  230.    UpdateLogPointer
  231.    Loged = True
  232.    Exit Sub
  233.  
  234. ErrHandler:
  235.    FunctionComp = False
  236.    Resume Next
  237. End Sub
  238.  
  239. Private Sub ExitDlg_Click()
  240.     Hide
  241. End Sub
  242.  
  243. Private Sub UpdateLogPointer()
  244.     LogEnd = LogEnd + 1
  245.     If LogEnd = MAXLOGNUM + 1 Then
  246.        LogEnd = 0
  247.     End If
  248.  
  249.     If LogTop = LogEnd Then
  250.        LogTop = LogTop + 1
  251.        If LogTop = MAXLOGNUM + 1 Then
  252.           LogTop = 0
  253.        End If
  254.     End If
  255. End Sub
  256.  
  257. Private Sub Form_Load()
  258. On Error GoTo ErrHandler
  259.    FunctionComp = True
  260.  
  261.    rc = DoEvents()              'If you use VisualBasic V2.0, call
  262.                                 'DoEvents function each time before
  263.                                 'starting DDE conversation.
  264.    ConfigurationDataText.LinkTimeout = -1
  265.    ConfigurationDataText.LinkTopic = "IBM327032|System"
  266.    ConfigurationDataText.LinkMode = COLD
  267.    ConfigurationDataText.LinkItem = "SysCon"
  268.    ConfigurationDataText.LinkRequest
  269.    ConfigurationDataText.LinkMode = NONE
  270.    If FunctionComp = True Then
  271.       If DisplaySystemStatus() = True Then
  272.   '       MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
  273.          EndStatus$ = MSG_OK
  274.       Else
  275.          MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  276.          EndStatus$ = MSG_NG
  277.       End If
  278.    Else
  279.       DisplaySystemStatusError
  280.       MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
  281.       EndStatus$ = MSG_NG
  282.    End If
  283.    TempLogData$ = Time$ + ":Get System Configuration : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
  284.    TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
  285.    TempLogData$ = TempLogData$ + MSG_TOPIC + """System""" + Chr$(13) + Chr$(10) + Chr$(9)
  286.    TempLogData$ = TempLogData$ + MSG_ITEM + """SysCon""" + Chr$(13) + Chr$(10) + Chr$(9)
  287.    TempLogData$ = TempLogData$ + "Data =" + """" + ConfigurationDataText.Text + """" + Chr$(13) + Chr$(10)
  288.    LogData$(LogEnd) = TempLogData$
  289.    UpdateLogPointer
  290.    Loged = True
  291.    Exit Sub
  292.  
  293. ErrHandler:
  294.    FunctionComp = False
  295.    Resume Next
  296.  
  297. End Sub
  298.  
  299.  
  300.  
  301. Private Sub DisplaySystemStatusError()
  302.       Version.Caption = "Undetermined"
  303.       Level.Caption = "Undetermined"
  304.       DateLog.Caption = "Undetermined"
  305.       SysModel.Caption = "Undetermined"
  306.       Moniter.Caption = "Undetermined"
  307.       Country.Caption = "Undetermined"
  308.  
  309. End Sub
  310.  
  311.