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

  1. VERSION 4.00
  2. Begin VB.Form FormSessExMacroWin 
  3.    Caption         =   "Window"
  4.    ClientHeight    =   3852
  5.    ClientLeft      =   4452
  6.    ClientTop       =   3228
  7.    ClientWidth     =   3036
  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          =   4176
  19.    Left            =   4404
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   3852
  23.    ScaleWidth      =   3036
  24.    Top             =   2952
  25.    Width           =   3132
  26.    Begin VB.ComboBox SessionIdList 
  27.       BackColor       =   &H00FFFFC0&
  28.       ForeColor       =   &H00000000&
  29.       Height          =   288
  30.       ItemData        =   "FSESEXWI.frx":0000
  31.       Left            =   1320
  32.       List            =   "FSESEXWI.frx":0052
  33.       Sorted          =   -1  'True
  34.       Style           =   2  'Dropdown List
  35.       TabIndex        =   0
  36.       Top             =   480
  37.       Width           =   492
  38.    End
  39.    Begin VB.CommandButton ExitDlg 
  40.       Cancel          =   -1  'True
  41.       Caption         =   "E&xit"
  42.       Height          =   372
  43.       Left            =   1800
  44.       TabIndex        =   10
  45.       Top             =   3360
  46.       Width           =   852
  47.    End
  48.    Begin VB.CommandButton Execute 
  49.       Caption         =   "&Execute"
  50.       Default         =   -1  'True
  51.       Height          =   372
  52.       Left            =   360
  53.       TabIndex        =   9
  54.       Top             =   3360
  55.       Width           =   852
  56.    End
  57.    Begin VB.Frame Frame1 
  58.       Caption         =   "Window command"
  59.       ForeColor       =   &H80000008&
  60.       Height          =   2292
  61.       Left            =   240
  62.       TabIndex        =   1
  63.       Top             =   840
  64.       Width           =   2532
  65.       Begin VB.TextBox DataText 
  66.          Height          =   372
  67.          Left            =   1680
  68.          TabIndex        =   11
  69.          Top             =   1200
  70.          Visible         =   0   'False
  71.          Width           =   204
  72.       End
  73.       Begin VB.TextBox CngnameText 
  74.          BackColor       =   &H00FFFFC0&
  75.          Enabled         =   0   'False
  76.          BeginProperty Font 
  77.             name            =   "System"
  78.             charset         =   0
  79.             weight          =   700
  80.             size            =   9.6
  81.             underline       =   0   'False
  82.             italic          =   0   'False
  83.             strikethrough   =   0   'False
  84.          EndProperty
  85.          ForeColor       =   &H00000000&
  86.          Height          =   492
  87.          Left            =   288
  88.          MultiLine       =   -1  'True
  89.          ScrollBars      =   1  'Horizontal
  90.          TabIndex        =   8
  91.          Top             =   1680
  92.          Width           =   2124
  93.       End
  94.       Begin VB.OptionButton CngnameOption 
  95.          Caption         =   "&CNGNAME"
  96.          ForeColor       =   &H80000008&
  97.          Height          =   252
  98.          Left            =   96
  99.          TabIndex        =   7
  100.          Top             =   1440
  101.          Width           =   1260
  102.       End
  103.       Begin VB.OptionButton ShowOption 
  104.          Caption         =   "&SHOW"
  105.          ForeColor       =   &H80000008&
  106.          Height          =   252
  107.          Left            =   96
  108.          TabIndex        =   6
  109.          Top             =   1200
  110.          Width           =   1356
  111.       End
  112.       Begin VB.OptionButton MinimizeOption 
  113.          Caption         =   "MI&NIMIZE"
  114.          ForeColor       =   &H80000008&
  115.          Height          =   252
  116.          Left            =   96
  117.          TabIndex        =   5
  118.          Top             =   960
  119.          Width           =   1356
  120.       End
  121.       Begin VB.OptionButton MaximizeOption 
  122.          Caption         =   "&MAXIMIZE"
  123.          ForeColor       =   &H80000008&
  124.          Height          =   252
  125.          Left            =   96
  126.          TabIndex        =   4
  127.          Top             =   720
  128.          Width           =   1356
  129.       End
  130.       Begin VB.OptionButton RestoreOption 
  131.          Caption         =   "&RESTORE"
  132.          ForeColor       =   &H80000008&
  133.          Height          =   252
  134.          Left            =   96
  135.          TabIndex        =   3
  136.          Top             =   480
  137.          Width           =   1356
  138.       End
  139.       Begin VB.OptionButton HideOption 
  140.          Caption         =   "&HIDE"
  141.          ForeColor       =   &H80000008&
  142.          Height          =   252
  143.          Left            =   96
  144.          TabIndex        =   2
  145.          Top             =   240
  146.          Value           =   -1  'True
  147.          Width           =   1356
  148.       End
  149.    End
  150.    Begin VB.Frame Frame2 
  151.       Caption         =   "Input Parameters"
  152.       Height          =   3132
  153.       Left            =   120
  154.       TabIndex        =   12
  155.       Top             =   120
  156.       Width           =   2772
  157.       Begin VB.Label Label1 
  158.          Caption         =   "Session &Id"
  159.          Height          =   252
  160.          Left            =   120
  161.          TabIndex        =   13
  162.          Top             =   360
  163.          Width           =   1092
  164.       End
  165.    End
  166. End
  167. Attribute VB_Name = "FormSessExMacroWin"
  168. Attribute VB_Creatable = False
  169. Attribute VB_Exposed = False
  170.  
  171. Private Sub CngnameOption_Click()
  172.     CngnameText.Enabled = True
  173. End Sub
  174.  
  175. Private Sub Execute_Click()
  176. On Error GoTo ErrHandler
  177.    FunctionComp = True
  178.    
  179.    OldMousePointer = MousePointer
  180.    MousePointer = 11 ' Hour Glass Mouse Pointer
  181.    
  182.    DisplayType$ = GetDisplayType$(SessionIdList.Text)
  183.    
  184.    If DisplayType$ = "NONE" Then
  185.       MousePointer = OldMousePointer
  186.       MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
  187.       Exit Sub
  188.    End If
  189.  
  190.    temp$ = LTrim$(RTrim$(SessionIdList.Text))
  191.    If Len(temp$) > 0 Then
  192.       Topic$ = "Session" + SessionIdList.Text
  193.    Else
  194.       MousePointer = OldMousePointer
  195.       MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  196.       Exit Sub
  197.    End If
  198.    CommandString$ = GetSessExWinData()
  199.  
  200.    rc = DoEvents()           'If you use VisualBasic V2.0, call
  201.                              'DoEvents function each time before
  202.                              'starting DDE conversation.
  203.    DataText.LinkTimeout = -1
  204.    DataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
  205.    DataText.LinkMode = COLD
  206.    DataText.LinkExecute CommandString$
  207.    DataText.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$ + ":Session Execute Macro : " + 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$ + "Command = " + """" + CommandString$ + """" + Chr$(13) + Chr$(10)
  221.    LogData$(LogEnd) = TempLogData$
  222.    UpdateLogPointer
  223.    Loged = True
  224.    Exit Sub
  225.  
  226. ErrHandler:
  227.    FunctionComp = False
  228.    Resume Next
  229. End Sub
  230.  
  231. Private Sub ExitDlg_Click()
  232.     DataText.LinkMode = NONE
  233.     Hide
  234. End Sub
  235.  
  236. Private Function GetSessExWinData() As String
  237.    Dim Action As String
  238.  
  239.    If HideOption.Value = True Then
  240.       Action = "HIDE"
  241.    ElseIf RestoreOption.Value = True Then
  242.       Action = "RESTORE"
  243.    ElseIf MaximizeOption.Value = True Then
  244.       Action = "MAXIMIZE"
  245.    ElseIf MinimizeOption.Value = True Then
  246.       Action = "MINIMIZE"
  247.    ElseIf ShowOption.Value = True Then
  248.       Action = "SHOW"
  249.    Else
  250.       If Left$(CngnameText.Text, 1) = """" Then
  251.          temp$ = CngnameText.Text
  252.       Else
  253.          temp$ = """" + CngnameText.Text + """"
  254.       End If
  255.       Action = "CNGNAME" + "," + temp$
  256.    End If
  257.  
  258.    GetSessExWinData = "[WINDOW(" + Action + ")]"
  259.  
  260. End Function
  261.  
  262. Private Sub Form_Load()
  263.   SessionIdList.ListIndex = 0
  264.   AdjustForNT351 FormSessExMacroWin
  265. End Sub
  266.  
  267. Private Sub HideOption_Click()
  268.     CngnameText.Enabled = False
  269. End Sub
  270.  
  271. Private Sub MaximizeOption_Click()
  272.     CngnameText.Enabled = False
  273. End Sub
  274.  
  275. Private Sub MinimizeOption_Click()
  276.     CngnameText.Enabled = False
  277. End Sub
  278.  
  279. Private Sub RestoreOption_Click()
  280.     CngnameText.Enabled = False
  281. End Sub
  282.  
  283. Private Sub ShowOption_Click()
  284.     CngnameText.Enabled = False
  285. End Sub
  286.  
  287. Private Sub UpdateLogPointer()
  288.     LogEnd = LogEnd + 1
  289.     If LogEnd = MAXLOGNUM + 1 Then
  290.        LogEnd = 0
  291.     End If
  292.  
  293.     If LogTop = LogEnd Then
  294.        LogTop = LogTop + 1
  295.        If LogTop = MAXLOGNUM + 1 Then
  296.           LogTop = 0
  297.        End If
  298.     End If
  299. End Sub
  300.  
  301.