Jonathan Jenne 16a6febb34 jj
2019-08-09 17:12:34 +02:00

51 lines
1.8 KiB
VB.net

Imports System.Windows.Automation
Imports DD_Clipboard_Watcher.ClassWindowAPI
Public Class frmControlCapture
Public ControlName As String
Public ProcessName As String
Public AutomationId As String
Public FrameworkId As String
Public Automation As ClassAutomation
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim oResult As WindowInfo = GetFocusedControl(Handle)
If oResult IsNot Nothing Then
txtPID.Text = oResult.ClassName
txtName.Text = oResult.ProcessName
txtControlName.Text = oResult.ControlName
txtAutomationId.Text = Automation.AutomationId
txtFrameworkId.Text = Automation.FrameworkId
FrameworkId = Automation.FrameworkId
AutomationId = Automation.AutomationId
ControlName = oResult.ControlName
ProcessName = oResult.ProcessName
End If
End Sub
Private Sub frmControlCapture_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Automation = New ClassAutomation(LogConfig)
End Sub
Private Sub frmControlCapture_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Automation.RemoveHandler()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If chkAutomationId.Checked = False Then
AutomationId = String.Empty
End If
If chkControlName.Checked = False Then
ControlName = String.Empty
End If
If chkAutomationId.Checked = False And chkControlName.Checked = False Then
MsgBox("Es muss entweder die AutomationId oder der Feldname ausgewählt sein!", MsgBoxStyle.Exclamation, Text)
DialogResult = DialogResult.None
End If
End Sub
End Class