home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
pc3270sa.zip
/
vbdde
/
fstkyint.frm
< prev
next >
Wrap
Text File
|
2002-02-28
|
10KB
|
342 lines
VERSION 4.00
Begin VB.Form FormStartKeystrokeIntercept
Caption = "Start Keystroke Intercept"
ClientHeight = 4092
ClientLeft = 4236
ClientTop = 3780
ClientWidth = 3732
ControlBox = 0 'False
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 4416
Left = 4188
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 4092
ScaleWidth = 3732
Top = 3504
Width = 3828
Begin VB.Frame Frame3
Caption = "Intercepted Key"
Height = 612
Left = 120
TabIndex = 13
Top = 2880
Width = 3492
Begin VB.Label LastInterceptedKeyLabel
Alignment = 2 'Center
Height = 252
Left = 120
TabIndex = 14
Top = 240
Width = 3252
End
End
Begin VB.ComboBox SessionIdList
BackColor = &H00FFFFC0&
ForeColor = &H00000000&
Height = 288
ItemData = "FSTKYINT.frx":0000
Left = 1320
List = "FSTKYINT.frx":0052
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 2
Top = 360
Width = 492
End
Begin VB.CommandButton ExitCommand
Cancel = -1 'True
Caption = "E&xit"
Height = 372
Left = 2640
TabIndex = 10
Top = 3600
Width = 852
End
Begin VB.CommandButton StopCommand
Caption = "&End"
Enabled = 0 'False
Height = 372
Left = 1440
TabIndex = 9
Top = 3600
Width = 852
End
Begin VB.CommandButton StartCommand
Caption = "&Begin"
Default = -1 'True
Height = 372
Left = 216
TabIndex = 8
Top = 3600
Width = 876
End
Begin VB.Frame UserDefFrame
Caption = "User Defined &String"
Enabled = 0 'False
ForeColor = &H80000008&
Height = 612
Left = 240
TabIndex = 4
Top = 1080
Width = 3252
Begin VB.TextBox UserDefStrText
BackColor = &H00FFFFC0&
Enabled = 0 'False
ForeColor = &H00000000&
Height = 288
Left = 120
TabIndex = 5
Text = "example"
Top = 240
Width = 2964
End
End
Begin VB.TextBox KeyInterceptText
BackColor = &H00C0FFFF&
Height = 372
Left = 2400
TabIndex = 11
Top = 3600
Visible = 0 'False
Width = 192
End
Begin VB.CheckBox TopicCheck
Caption = "&Use Session Topic Name "
ForeColor = &H80000008&
Height = 372
Left = 312
TabIndex = 3
Top = 720
Value = 1 'Checked
Width = 2508
End
Begin VB.Frame Frame1
Caption = "Input Parameters"
Height = 2412
Left = 120
TabIndex = 0
Top = 120
Width = 3492
Begin VB.Frame Frame2
Caption = "Topic"
Height = 612
Left = 120
TabIndex = 6
Top = 1680
Width = 3252
Begin VB.Label TopicLabel
Alignment = 2 'Center
Caption = "SessionA"
Height = 252
Left = 120
TabIndex = 7
Top = 240
Width = 3012
End
End
Begin VB.Label Label1
Caption = "Session &Id"
Height = 252
Left = 120
TabIndex = 1
Top = 240
Width = 1092
End
End
Begin VB.Label ResultMessageLabel
Alignment = 2 'Center
Caption = "DDE Conversation Active"
ForeColor = &H00FF0000&
Height = 252
Left = 240
TabIndex = 12
Top = 2640
Visible = 0 'False
Width = 3276
End
End
Attribute VB_Name = "FormStartKeystrokeIntercept"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Sub ExitCommand_Click()
Unload FormStartKeystrokeIntercept
End Sub
Private Function GetTopicName() As String
If Len(SessionIdList.Text) > 0 Then
If TopicCheck.Value = CHECKED Then
ReturnString$ = "Session" + SessionIdList.Text
Else
ReturnString$ = "Sess" + SessionIdList.Text + "_" + UserDefStrText.Text
End If
GetTopicName = ReturnString$
Else
MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
End If
End Function
Private Sub Form_Load()
SessionIdList.ListIndex = 0
End Sub
Private Sub KeyInterceptText_Change()
If StartCommand.Enabled = False Then
If Len(RTrim$(LTrim$(KeyInterceptText.Text))) > 0 Then
LogData$(LogEnd) = Time$ + ":Keystroke was Intercepted :" + Chr$(13) + Chr$(10) + Chr$(9) + "Data=" + KeyInterceptText.Text + Chr$(13) + Chr$(10)
UpdateLogPointer
UpdateLog
LastInterceptedKeyLabel.Caption = KeyInterceptText.Text
End If
End If
End Sub
Private Sub StartCommand_Click()
On Error GoTo ErrHandler
FunctionComp = True
OldMousePointer = MousePointer
MousePointer = 11 ' Hour Glass Mouse Pointer
LastInterceptedKeyLabel.Caption = ""
DisplayType$ = GetDisplayType$(SessionIdList.Text)
If DisplayType$ = "NONE" Then
MousePointer = OldMousePointer
MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
Exit Sub
End If
Topic$ = GetTopicName()
If Len(Topic$) <= 0 Then
MousePointer = OldMousePointer
Exit Sub
End If
Item$ = "KEYS"
rc = DoEvents() 'If you use VisualBasic V2.0, call
'DoEvents function each time before
'starting DDE conversation.
KeyInterceptText.LinkTimeout = -1
KeyInterceptText.LinkTopic = APPLICATION_NAME + "|" + Topic$
KeyInterceptText.LinkItem = Item$
KeyInterceptText.LinkMode = HOT
MousePointer = OldMousePointer
If FunctionComp = True Then
ResultMessageLabel.Visible = True
EndStatus$ = MSG_OK
StartCommand.Enabled = False
StopCommand.Enabled = True
ExitCommand.Enabled = False
Else
ResultMessageLabel.Visible = False
MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
EndStatus$ = MSG_NG
End If
TempLogData$ = Time$ + ":Start Keystroke Intercept : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_ITEM + """" + Item$ + """" + Chr$(13) + Chr$(10)
LogData$(LogEnd) = TempLogData$
UpdateLogPointer
UpdateLog
Exit Sub
ErrHandler:
FunctionComp = False
Resume Next
End Sub
Private Sub StopCommand_Click()
On Error GoTo StopErrHandler
FunctionComp = True
KeyInterceptText.LinkTimeout = -1
KeyInterceptText.LinkMode = NONE
StartCommand.Enabled = True
If FunctionComp = True Then
ResultMessageLabel.Visible = False
EndStatus$ = MSG_OK
StopCommand.Enabled = False
StartCommand.Enabled = True
ExitCommand.Enabled = True
Else
MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
EndStatus$ = MSG_NG
End If
LogData$(LogEnd) = Time$ + ":Stop Keystroke Intercept : " + EndStatus$ + Chr$(13) + Chr$(10)
UpdateLogPointer
UpdateLog
Exit Sub
StopErrHandler:
FunctionComp = False
Resume Next
End Sub
Private Sub TopicCheck_Click()
If TopicCheck.Value = CHECKED Then
UserDefFrame.Enabled = False
UserDefStrText.Enabled = False
Else
UserDefFrame.Enabled = True
UserDefStrText.Enabled = True
End If
TopicLabel.Caption = GetTopicName()
End Sub
Private Sub UpdateLog()
temp$ = " "
If LogTop > LogEnd Then
For i% = LogTop To MAXLOGNUM
temp$ = temp$ + LogData$(i%)
Next
For i% = 0 To LogEnd
temp$ = temp$ + LogData$(i%)
Next
ElseIf LogTop < LogEnd Then
For i% = LogTop To LogEnd
temp$ = temp$ + LogData(i%)
Next
Else
temp$ = LogData(i%)
End If
MainForm.FunctionLog.Text = temp$
Loged = False
End Sub
Private Sub UpdateLogPointer()
LogEnd = LogEnd + 1
If LogEnd = MAXLOGNUM + 1 Then
LogEnd = 0
End If
If LogTop = LogEnd Then
LogTop = LogTop + 1
If LogTop = MAXLOGNUM + 1 Then
LogTop = 0
End If
End If
End Sub
Private Sub UserDefStrText_Change()
TopicLabel.Caption = GetTopicName()
End Sub