This commit is contained in:
SchreiberM 2017-02-16 20:28:26 +01:00
commit 660a802882
25 changed files with 580 additions and 492 deletions

Binary file not shown.

View File

@ -1,5 +1,6 @@
Imports Microsoft.VisualBasic.ControlChars
Imports System.Runtime.InteropServices
Imports DD_LIB_Standards
Public Class ClipboardWatcher : Inherits NativeWindow : Implements IDisposable
<DllImport("user32", EntryPoint:="SetClipboardViewer")> _
@ -26,7 +27,7 @@ Public Class ClipboardWatcher : Inherits NativeWindow : Implements IDisposable
'Dim CapTxt As String = clsWINDOWSApi.GetCaption()
If IsNothing(PROC_Name) Then Exit Sub
If PROC_Name.StartsWith("DD_Clipboard_Searcher") Then Exit Sub
Console.WriteLine("PROCESS_NAME: " & PROC_Name)
If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >>{0} - Clipboard ChangedEvent for process '{1}' fired!", Now.ToString, PROC_Name), False)
' If CapTxt.ToUpper.StartsWith("DD") Then Exit Sub
RaiseEvent Changed(Me, EventArgs.Empty)
End Select

View File

@ -1,9 +1,24 @@
Imports System.ComponentModel
Imports DD_LIB_Standards
Imports System.IO
Public Class ClassInit
Public _lizenzManager As clsLicenseManager
Public Sub InitLogger()
ClassLogger.Init("")
Try
' legt den Speicherort fest
Dim f As New IO.DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Digital Data\Clipboard Searcher\Log"))
If IO.Directory.Exists(f.ToString) = False Then
IO.Directory.CreateDirectory(f.ToString)
End If
Dim logfilename As String = f.ToString & "\" & System.DateTime.Now.ToString("yyyy_MM_dd") & ".txt"
LOGGER_FILEPATH = logfilename
clsLogger.LOGFILE_PATH = LOGGER_FILEPATH
Catch ex As Exception
MsgBox("Unexpected Error while initializing Logger: " & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Public Function InitDatabase()
Dim dbResult As Boolean
@ -42,11 +57,11 @@ Public Class ClassInit
USER_USERNAME = _User
End If
Dim sql = String.Format("SELECT * FROM TBDD_USER WHERE (LOWER(USERNAME) = LOWER('{0}'))", USER_USERNAME)
ClassLogger.Add(">> Login time: " & Now.ToString, False)
ClassLogger.Add(">> Username: " & USER_USERNAME, False)
clsLogger.Add(">> Login Username: " & USER_USERNAME, False)
clsLogger.Add(">> Login time: " & Now.ToString, False)
Dim USER_DT As DataTable = clsDatabase.Return_Datatable(sql, True)
If USER_DT.Rows.Count = 0 Then
ClassLogger.Add(" - User '" & USER_USERNAME & "' not listed in Useradminsitration!", False)
clsLogger.Add(" - User '" & USER_USERNAME & "' not listed in Useradminsitration!", False)
'MsgBox("Achtung: Sie sind nicht in der Userverwaltung hinterlegt." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:")
'Me.Close()
Dim msg = String.Format("You are not listed in the Useradministration." & vbNewLine & "Please contact the admin.")
@ -56,10 +71,19 @@ Public Class ClassInit
USER_GUID = USER_DT.Rows(0).Item("GUID")
USER_LANGUAGE = USER_DT.Rows(0).Item("LANGUAGE")
DT_CLIENT_USER = clsDatabase.Return_Datatable("SELECT T.*, T1.CLIENT_NAME FROM TBDD_CLIENT_USER T,TBDD_CLIENT T1 WHERE T.CLIENT_ID = T1.GUID AND T.USER_ID = " & USER_GUID, True)
Dim Access_right As Boolean = False
sql = String.Format("SELECT COUNT(T.GUID) FROM TBDD_USER_MODULES T, TBDD_MODULES T1 WHERE T.MODULE_ID = T1.GUID AND UPPER(T1.NAME) = UPPER('Clipboard-Searcher') AND T.USER_ID = {0}", USER_GUID)
Dim USER2MODULE = clsDatabase.Execute_Scalar(sql)
If Not IsNothing(USER2MODULE) Then
If USER2MODULE = 1 Then
Access_right = True
End If
Else
Access_right = USER_DT.Rows(0).Item("MODULE_DDCBSEARCHER")
End If
Dim Access_right As Boolean = USER_DT.Rows(0).Item("MODULE_DDCBSEARCHER")
If Access_right = False Then
ClassLogger.Add(" - User: " & USER_USERNAME & " nicht für Modul freigegben!", False)
clsLogger.Add(" - User: " & USER_USERNAME & " nicht für Modul freigegben!", False)
'MsgBox("Achtung: Sie sind nicht für die Nutzung dieses Moduls freigeschaltet." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:")
Dim msg = String.Format("Sie sind nicht für die Nutzung dieses Moduls freigeschaltet." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!")
@ -102,7 +126,7 @@ Public Class ClassInit
sql = String.Format("SELECT COUNT(*) AS Expr1 FROM TBDD_USER_MODULE_LOG_IN WHERE UPPER(MODULE) = UPPER('Clipboard-Searcher') AND CLIENT_ID = {0}", 0)
Dim anzahl = clsDatabase.Execute_Scalar(sql)
USERS_LOGGED_IN = CInt(anzahl)
If LogErrorsOnly = False Then ClassLogger.Add(" >> User# logged in: " & anzahl.ToString, False)
If LogErrorsOnly = False Then clsLogger.Add(" >> Count Users logged in: " & anzahl.ToString, False)
'####
If LICENSE_COUNT < USERS_LOGGED_IN And LICENSE_EXPIRED = False Then
@ -113,12 +137,12 @@ Public Class ClassInit
"Number of licenses: " & LICENSE_COUNT.ToString & vbNewLine & "Please contact Your admin!")
End If
MsgBox(msg, MsgBoxStyle.Exclamation)
ClassLogger.Add(" >> The number of logged Users (" & USERS_LOGGED_IN.ToString & ") exceeds the number of licenses (" & LICENSE_COUNT & ") ", False)
clsLogger.Add(" >> The number of logged Users (" & USERS_LOGGED_IN.ToString & ") exceeds the number of licenses (" & LICENSE_COUNT & ") ", False)
If USER_IS_ADMIN = False Then
'Anmeldung wieder herausnehmen
sql = "DELETE FROM TBDD_USER_MODULE_LOG_IN WHERE USER_ID = " & USER_GUID & " AND MODULE= 'Clipboard-Searcher'"
clsDatabase.Execute_non_Query(sql, True)
ClassLogger.Add(" - logged out the user", False)
clsLogger.Add(" - logged out the user", False)
Return False
End If
End If
@ -127,7 +151,7 @@ Public Class ClassInit
End If
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in InitUserLogin: " & ex.Message, True)
clsLogger.Add("Unexpected Error in InitUserLogin: " & ex.Message, True)
MsgBox("Unexpected Error in InitUserLogin: " & ex.Message, MsgBoxStyle.Critical)
Return False
End Try

View File

@ -1,5 +1,6 @@
Imports System.Xml
Imports System.IO
Imports DD_LIB_Standards
Public Class ClassWindowLocation
@ -35,7 +36,7 @@ Public Class ClassWindowLocation
End Select
If x = 5000 Then
form.WindowState = FormWindowState.Maximized
form.WindowState = FormWindowState.Maximized
Else
If x > 0 Then
form.Location = New Point(x, y)
@ -46,7 +47,7 @@ Public Class ClassWindowLocation
Next
Catch notFoundEx As System.IO.FileNotFoundException
ClassLogger.Add("Window Position & Size added for Form " & form.Name)
clsLogger.Add("Window Position & Size added for Form " & form.Name)
Catch ex As Exception
MsgBox("Error while loading Window Position!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
@ -81,7 +82,7 @@ Public Class ClassWindowLocation
layout.Save(settings)
Catch notFoundEx As System.IO.FileNotFoundException
ClassLogger.Add("Window Position & Size added for Form " & form.Name)
clsLogger.Add("Window Position & Size added for Form " & form.Name)
Catch ex As Exception
MsgBox("Error while saving Window Position!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try

View File

@ -1,201 +0,0 @@
Imports System.IO
Imports DD_LIB_Standards
Public Class ClassLogger
Public Shared DateiSpeicherort As String = Nothing
Public Shared DateiPrefix As String = ""
Public Shared Datei As IO.File = Nothing
Public Shared logDateiname As String = ""
Private Shared StreamWriter As IO.StreamWriter = Nothing
Private Shared HasInformedAboutError As Boolean = False
' eine Art Konstruktor
Public Shared Sub Init(ByVal speicherort As String, Optional ByVal prefix As String = "", Optional ByVal appendFile As Boolean = True)
' initialisiert den Speicherort
ClassLogger.SetSpeicherort(speicherort)
' wenn ein Prfix gesetzt wurde
If Not prefix = "" Then
' initialisiert das Prefix
ClassLogger.SetPrefix(prefix)
End If
Dim str As String = ClassLogger.DateiSpeicherort & "\" & ClassLogger.DateiPrefix & System.DateTime.Now.ToString("yyyy_MM_dd") & ".txt"
Dim anz As Integer = 1
Do While File.Exists(str)
Dim info As New FileInfo(str)
Dim length As Long = info.Length
If length > 5000000 Then
str = IO.Path.GetDirectoryName(str)
str = str & "\" & ClassLogger.DateiPrefix & System.DateTime.Now.ToString("yyyy_MM_dd") & "(" & anz.ToString & ").txt"
anz = anz + 1
Else
Exit Do
End If
Loop
ClassLogger.logDateiname = str
If Not appendFile Then
' der Versuch die Datei zu löschen
My.Computer.FileSystem.WriteAllText(ClassLogger.logDateiname, String.Empty, False)
End If
' testen ob sich die Datei öffnen und beschreiben lässt
'ClassNILogger.CheckIsLogWritable()
End Sub
' legt den Speicherort fest
Public Shared Sub SetSpeicherort(ByVal speicherort As String)
Dim f As String = Application.UserAppDataPath() & "\Log"
If speicherort = "" Then
If IO.Directory.Exists(f) = False Then
IO.Directory.CreateDirectory(f)
End If
ClassLogger.DateiSpeicherort = f
Else
ClassLogger.DateiSpeicherort = speicherort
End If
' clsLogger.LOGFILE_PATH = ClassLogger.DateiSpeicherort
End Sub
' legt das Prefix für den Dateinamen fest
Public Shared Sub SetPrefix(ByVal prefix As String)
ClassLogger.DateiPrefix = prefix
End Sub
Public Shared Sub Add(ByVal information As String, Optional ByVal ACHTUNG As Boolean = True)
If ClassLogger.OpenFile Then
Try
If ACHTUNG Then
ClassLogger.StreamWriter.WriteLine("#ATTENTION# (" & System.DateTime.Now & "): " & information)
Else
ClassLogger.StreamWriter.WriteLine(information)
End If
ClassLogger.CloseFile()
Catch e As Exception
ClassLogger.ShowErrorMessage()
End Try
Else
ClassLogger.ShowErrorMessage()
End If
End Sub
'Public Shared Sub Add(ByVal ex As Exception)
' If ClassLogger.OpenFile Then
' Try
' ClassLogger.StreamWriter.WriteLine("##### Exception (" & System.DateTime.Now & ")")
' ClassLogger.StreamWriter.WriteLine("##### Error: " & ex.Message & " Source [" & ex.Source & "]")
' ClassLogger.CloseFile()
' Catch e As Exception
' ClassLogger.ShowErrorMessage()
' End Try
' Else
' ClassLogger.ShowErrorMessage()
' End If
'End Sub
' öffnet eine Datei zum Schreiben
Private Shared Function OpenFile()
Try
' wenn ein Speicherort festgelegt wurde
If Not ClassLogger.DateiSpeicherort = Nothing Then
' den Dateienamen definieren
Dim dateiname As String = ClassLogger.logDateiname
' Datei anlegen wenn noch nicht vorhanden
My.Computer.FileSystem.WriteAllText(dateiname, String.Empty, True)
' die Datei zum Schreiben öffnen
ClassLogger.StreamWriter = New IO.StreamWriter(dateiname, True, System.Text.Encoding.UTF8)
End If
' wenn die Datei erfolgreich geöffnet wurde
If ClassLogger.StreamWriter IsNot Nothing Then
Return True
Else
Return False
End If
Catch ex As Exception
Return False
End Try
End Function
' öffnet eine Datei zum Schreiben
Private Shared Function OpenFile(ByVal DateiSpeicherort As String, ByVal DateiPrefix As String)
Try
' wenn ein Speicherort festgelegt wurde
If Not DateiSpeicherort = Nothing And ClassLogger.CheckIsLogWritable() Then
' den Dateienamen definieren
Dim dateiname As String = ClassLogger.logDateiname
' Datei anlegen wenn noch nicht vorhanden
My.Computer.FileSystem.WriteAllText(dateiname, String.Empty, True)
' die Datei zum Schreiben öffnen
ClassLogger.StreamWriter = New IO.StreamWriter(dateiname, True, System.Text.Encoding.UTF8)
End If
' wenn die Datei erfolgreich geöffnet wurde
If ClassLogger.StreamWriter IsNot Nothing Then
Return True
Else
Return False
End If
Catch ex As Exception
Return False
End Try
End Function
' schliesst die geöffnete Datei
Private Shared Sub CloseFile()
' wenn eine Datei geöffnet ist
If ClassLogger.StreamWriter IsNot Nothing Then
' die Datei schliessen
ClassLogger.StreamWriter.Close()
ClassLogger.StreamWriter = Nothing
End If
End Sub
Public Shared Function CheckIsLogWritable()
If ClassLogger.OpenFile Then
Try
ClassLogger.CloseFile()
Catch e As Exception
ClassLogger.ShowErrorMessage()
Return False
End Try
Else
ClassLogger.ShowErrorMessage()
Return False
End If
Return True
End Function
Public Shared Function CheckIsLogWritable(ByVal vDateiSpeicherort As String, ByVal vDateiPrefix As String)
If ClassLogger.OpenFile(vDateiSpeicherort, vDateiPrefix) Then
Try
ClassLogger.CloseFile()
Catch e As Exception
ClassLogger.ShowErrorMessage()
Return False
End Try
Else
ClassLogger.ShowErrorMessage()
Return False
End If
Return True
End Function
Private Shared Sub ShowErrorMessage()
If Not ClassLogger.HasInformedAboutError Then
MsgBox("Please make sure You can access the logpath and are able to write to the file. This may be due to security privileges or storage place in the drive." & _
vbNewLine & vbNewLine & "A logfile won't be written from now on." & vbNewLine & vbNewLine & "You won't be informed about further logdetails from now on.", _
MsgBoxStyle.Information, "Error opening Logfile")
ClassLogger.HasInformedAboutError = True
End If
End Sub
End Class

View File

@ -92,7 +92,7 @@
<Compile Include="Class1.vb" />
<Compile Include="ClassInit.vb" />
<Compile Include="ClassLayout.vb" />
<Compile Include="ClassLogger.vb" />
<Compile Include="clsHotkey.vb" />
<Compile Include="clsLicense.vb" />
<Compile Include="clsSearch.vb" />
<Compile Include="clsWindowApivb.vb" />
@ -218,6 +218,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="KeyOutput_8167.ico" />
<None Include="Resources\ReduceSize.png" />
<None Include="Resources\KeyOutput_8167.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.3.0.1")>
<Assembly: AssemblyVersion("1.3.0.3")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -120,6 +120,16 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''</summary>
Friend ReadOnly Property ReduceSize() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("ReduceSize", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''</summary>

View File

@ -121,22 +121,25 @@
<data name="GoToDefinition_5575" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\GoToDefinition_5575.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_start_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_start_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="KeyOutput_8167" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\KeyOutput_8167.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="StatusAnnotations_Stop_16xLG" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\StatusAnnotations_Stop_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Annotation_New" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Annotation_New.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="KeyDown_8461" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\KeyDown_8461.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="folder_Open_16xLG" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\folder_Open_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="control_start_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\control_start_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="Annotation_New" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Annotation_New.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="KeyOutput_8167" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\KeyOutput_8167.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="ReduceSize" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ReduceSize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -144,6 +144,22 @@ TableAdapterManager is used to coordinate TableAdapters in the dataset to enable
<summary>
Build the ApiWindow object to hold information about the Window object.
</summary>
</member><member name="E:DD_Clipboard_Searcher.clsHotkey.HotKeyPressed">
<summary>
Diesem Event wird immer die zugewiesene HotKeyID übergeben wenn eine HotKey Kombination gedrückt wurde.
</summary>
</member><member name="M:DD_Clipboard_Searcher.clsHotkey.AddHotKey(System.Windows.Forms.Keys,DD_Clipboard_Searcher.clsHotkey.MODKEY,System.String)">
<summary>
Diese Funktion fügt einen Hotkey hinzu und registriert ihn auch sofort
</summary>
<param name="KeyCode">Den KeyCode für die Taste</param>
<param name="Modifiers">Die Zusatztasten wie z.B. Strg oder Alt, diese können auch mit OR kombiniert werden</param>
<param name="HotKeyID">Die ID die der Hotkey bekommen soll um diesen zu identifizieren</param>
</member><member name="M:DD_Clipboard_Searcher.clsHotkey.RemoveHotKey(System.String)">
<summary>
Diese Funktion entfernt einen Hotkey und deregistriert ihn auch sofort
</summary>
<param name="HotKeyID">Gibt die HotkeyID an welche entfernt werden soll</param>
</member><member name="P:DD_Clipboard_Searcher.My.Resources.Resources.ResourceManager">
<summary>
Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
@ -177,6 +193,10 @@ TableAdapterManager is used to coordinate TableAdapters in the dataset to enable
<summary>
Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
</summary>
</member><member name="P:DD_Clipboard_Searcher.My.Resources.Resources.ReduceSize">
<summary>
Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
</summary>
</member><member name="P:DD_Clipboard_Searcher.My.Resources.Resources.StatusAnnotations_Stop_16xLG">
<summary>
Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.

View File

@ -0,0 +1,139 @@
Imports DD_LIB_Standards
Public Class clsHotkey
Implements IMessageFilter
Private Declare Function RegisterHotKey Lib "user32" ( _
ByVal Hwnd As IntPtr, _
ByVal ID As Integer, _
ByVal Modifiers As Integer, _
ByVal Key As Integer) _
As Integer
Private Declare Function UnregisterHotKey Lib "user32" ( _
ByVal Hwnd As IntPtr, _
ByVal ID As Integer) _
As Integer
Private Declare Function GlobalAddAtom Lib "kernel32" Alias "GlobalAddAtomA" ( _
ByVal IDString As String) _
As Short
Private Declare Function GlobalDeleteAtom Lib "kernel32" ( _
ByVal Atom As Short) _
As Short
Public Class HotKeyObject
Private mHotKey As Keys
Private mModifier As MODKEY
Private mHotKeyID As String
Private mAtomID As Short
Public Property HotKey() As Keys
Get
Return mHotKey
End Get
Set(ByVal value As Keys)
mHotKey = value
End Set
End Property
Public Property Modifier() As MODKEY
Get
Return mModifier
End Get
Set(ByVal value As MODKEY)
mModifier = value
End Set
End Property
Public Property HotKeyID() As String
Get
Return mHotKeyID
End Get
Set(ByVal value As String)
mHotKeyID = value
End Set
End Property
Public Property AtomID() As Short
Get
Return mAtomID
End Get
Set(ByVal value As Short)
mAtomID = value
End Set
End Property
Sub New(ByVal NewHotKey As Keys, ByVal NewModifier As MODKEY, ByVal NewHotKeyID As String)
mHotKey = NewHotKey
mModifier = NewModifier
mHotKeyID = NewHotKeyID
End Sub
End Class
Public Shared Sub Refresh_Profile_Links()
Try
Dim sql = String.Format("SELECT T.*, T2.PROC_NAME FROM TBCBS_PROFILES T, TBCBS_USER_PROFILE T1, TBCBS_PROFILE_PROCESS T2 WHERE T.GUID = T1.PROFILE_ID AND T.GUID = T2.PROFILE_ID AND T1.USER_ID = {0}", USER_GUID)
DT_USER_PROFILES = clsDatabase.Return_Datatable(sql)
If DT_USER_PROFILES.Rows.Count = 0 Then
MsgBox("No profiles configured for this user so far!", MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
MsgBox("Unexpected Error in Refresh_Profile_Links: " & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private mForm As Form
Private Const WM_HOTKEY As Integer = &H312
Private mHotKeyList As New System.Collections.Generic.Dictionary(Of Short, HotKeyObject)
Private mHotKeyIDList As New System.Collections.Generic.Dictionary(Of String, Short)
''' <summary>
''' Diesem Event wird immer die zugewiesene HotKeyID übergeben wenn eine HotKey Kombination gedrückt wurde.
''' </summary>
Public Event HotKeyPressed(ByVal HotKeyID As String)
Public Enum MODKEY As Integer
MOD_ALT = 1
MOD_CONTROL = 2
MOD_SHIFT = 4
MOD_WIN = 8
End Enum
Sub New(ByVal OwnerForm As Form)
mForm = OwnerForm
Application.AddMessageFilter(Me)
End Sub
''' <summary>
''' Diese Funktion fügt einen Hotkey hinzu und registriert ihn auch sofort
''' </summary>
''' <param name="KeyCode">Den KeyCode für die Taste</param>
''' <param name="Modifiers">Die Zusatztasten wie z.B. Strg oder Alt, diese können auch mit OR kombiniert werden</param>
''' <param name="HotKeyID">Die ID die der Hotkey bekommen soll um diesen zu identifizieren</param>
Public Sub AddHotKey(ByVal KeyCode As Keys, ByVal Modifiers As MODKEY, ByVal HotKeyID As String)
If mHotKeyIDList.ContainsKey(HotKeyID) = True Then Exit Sub
Dim ID As Short = GlobalAddAtom(HotKeyID)
mHotKeyIDList.Add(HotKeyID, ID)
mHotKeyList.Add(ID, New HotKeyObject(KeyCode, Modifiers, HotKeyID))
RegisterHotKey(mForm.Handle, ID, mHotKeyList(ID).Modifier, mHotKeyList(ID).HotKey)
End Sub
''' <summary>
''' Diese Funktion entfernt einen Hotkey und deregistriert ihn auch sofort
''' </summary>
''' <param name="HotKeyID">Gibt die HotkeyID an welche entfernt werden soll</param>
Public Sub RemoveHotKey(ByVal HotKeyID As String)
If mHotKeyIDList.ContainsKey(HotKeyID) = False Then Exit Sub
Dim ID As Short = mHotKeyIDList(HotKeyID)
mHotKeyIDList.Remove(HotKeyID)
mHotKeyList.Remove(ID)
UnregisterHotKey(mForm.Handle, CInt(ID))
GlobalDeleteAtom(ID)
End Sub
Private Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean Implements System.Windows.Forms.IMessageFilter.PreFilterMessage
If m.Msg = WM_HOTKEY Then
RaiseEvent HotKeyPressed(mHotKeyList(CShort(m.WParam)).HotKeyID)
End If
End Function
End Class

View File

@ -1,6 +1,7 @@
Imports DD_LIB_Standards
Imports System.IO
Imports System.Text
Imports System.Runtime.InteropServices
Public Class clsSearch
@ -9,6 +10,9 @@ Public Class clsSearch
'Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function GetWindowRect Lib "user32.dll" (ByVal hWnd As IntPtr, ByRef lpRect As RECT) As Int32
Private Declare Function ShowWindow Lib "user32" (ByVal handle As IntPtr, ByVal nCmdShow As Integer) As Integer
<DllImport("user32.dll")> _
Private Shared Function SetForegroundWindow(ByVal hWnd As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
Private Structure RECT
Dim Left As Integer
@ -23,7 +27,7 @@ Public Class clsSearch
Dim extension = Path.GetExtension(BaseSearch)
Dim windream_temp_search As String = ""
If IO.File.Exists(BaseSearch) = False Then
ClassLogger.Add("Die Windream-Suche existiert nicht oder ist nicht zugreifbar!", True)
clsLogger.Add("Die Windream-Suche existiert nicht oder ist nicht zugreifbar!", True)
MsgBox("Die Windream-Suche existiert nicht oder ist nicht zugreifbar!", MsgBoxStyle.Critical)
Return Nothing
End If
@ -43,15 +47,15 @@ Public Class clsSearch
If WD_UNICODE = True Then
EncodingFormat = Encoding.GetEncoding(1252) '1252
If LogErrorsOnly = False Then ClassLogger.Add(" ...Unicode is used (Encoding.GetEncoding(1252))", False)
If LogErrorsOnly = False Then clsLogger.Add(" ...Unicode is used (Encoding.GetEncoding(1252))", False)
Else
If LogErrorsOnly = False Then ClassLogger.Add(" ...UTF8 (Encoding.GetEncoding(65001))", False)
If LogErrorsOnly = False Then clsLogger.Add(" ...UTF8 (Encoding.GetEncoding(65001))", False)
EncodingFormat = Encoding.GetEncoding(65001)
End If
If LogErrorsOnly = False Then ClassLogger.Add(" ...ReadAlltext: " & BaseSearch, False)
If LogErrorsOnly = False Then clsLogger.Add(" ...ReadAlltext: " & BaseSearch, False)
fileContents = My.Computer.FileSystem.ReadAllText(BaseSearch, EncodingFormat) ', System.Text.Encoding.Unicode
If LogErrorsOnly = False Then ClassLogger.Add(" ...fileContents geladen", False)
If LogErrorsOnly = False Then clsLogger.Add(" ...fileContents geladen", False)
fileContents = fileContents.Replace("Í", "Ö")
fileContents = fileContents.Replace("@Clipboard", CURR_MATCH_RESULT)
fileContents = fileContents.Replace("@CLIPBOARD", CURR_MATCH_RESULT)
@ -63,7 +67,7 @@ Public Class clsSearch
Try
'Die File schreiben
My.Computer.FileSystem.WriteAllText(windream_temp_search, fileContents, False, EncodingFormat)
If LogErrorsOnly = False Then ClassLogger.Add(" ...wrote Text to windream_temp_search: " & windream_temp_search, False)
If LogErrorsOnly = False Then clsLogger.Add(" ...wrote Text to windream_temp_search: " & windream_temp_search, False)
' XML-Datei öffnen und laden
Dim Stream As New IO.StreamReader(CStr(windream_temp_search), EncodingFormat)
Dim Reader As New System.Xml.XmlTextReader(Stream)
@ -74,9 +78,9 @@ Public Class clsSearch
xml.Load(Reader)
Reader.Close()
xml.Save(windream_temp_search)
If LogErrorsOnly = False Then ClassLogger.Add(" ...Xml Generiert: " & windream_temp_search, False)
If LogErrorsOnly = False Then clsLogger.Add(" ...Xml Generiert: " & windream_temp_search, False)
Catch ex As Exception
ClassLogger.Add("TempFile could not be created: " & ex.Message, True)
clsLogger.Add("TempFile could not be created: " & ex.Message, True)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unerwarteter Fehler in Write XmlSearch:")
End Try
@ -98,14 +102,14 @@ Public Class clsSearch
Dim rctMain As RECT
GetWindowRect(p.MainWindowHandle, rctMain)
If LogErrorsOnly = False Then
ClassLogger.Add(" ...Top-Position: " & rctMain.Top.ToString, False)
ClassLogger.Add(" ...Left-Position: " & rctMain.Left.ToString, False)
ClassLogger.Add(" ...Right-Position: " & rctMain.Right.ToString, False)
ClassLogger.Add(" ...Bottom-Position: " & rctMain.Bottom.ToString, False)
clsLogger.Add(" ...Top-Position: " & rctMain.Top.ToString, False)
clsLogger.Add(" ...Left-Position: " & rctMain.Left.ToString, False)
clsLogger.Add(" ...Right-Position: " & rctMain.Right.ToString, False)
clsLogger.Add(" ...Bottom-Position: " & rctMain.Bottom.ToString, False)
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Ausführen der windream-Suche:")
ClassLogger.Add("Unexpected error while executing search: " & ex.Message, True)
clsLogger.Add("Unexpected error while executing search: " & ex.Message, True)
Return "Unexpected error while executing search"
End Try
Dim psList() As Process
@ -123,23 +127,23 @@ Public Class clsSearch
ShowWindow(p.MainWindowHandle, 3) ' SW_MAXIMIZE
End If
End If
' SetForeGroundWindow( p.MainWindowHandle)
SetForegroundWindow(p.MainWindowHandle)
End If
Next p
Catch ex As Exception
ClassLogger.Add("Unexpected error while Setting foreground: " & ex.Message, True)
clsLogger.Add("Unexpected error while Setting foreground: " & ex.Message)
End Try
Return ""
Catch ex As Exception
ClassLogger.Add("Unexpected error in Create Search: " & ex.Message, True)
clsLogger.Add("Unexpected error in Create Search: " & ex.Message)
MsgBox("Error in Create Search:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return "Unexpected error in Create Search"
End Try
Catch ex As Exception
ClassLogger.Add("Unexpected error in RUN_WD_SEARCH: " & ex.Message, True)
clsLogger.Add("Unexpected error in RUN_WD_SEARCH: " & ex.Message)
MsgBox("Error in RUN_WD_SEARCH:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return "Unerwarteter Unexpected error in RUN_WD_SEARCH"
End Try

View File

@ -1,4 +1,6 @@
Public Class clsWINDOWSApi
Imports DD_LIB_Standards
Public Class clsWINDOWSApi
Private Declare Function GetForegroundWindow Lib "user32.dll" Alias "GetForegroundWindow" () As IntPtr
Private Declare Auto Function GetWindowText Lib "user32.dll" (ByVal hWnd As System.IntPtr, ByVal lpString As System.Text.StringBuilder, ByVal cch As Integer) As Integer
Private Declare Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hwnd As IntPtr, ByRef lpdwProcessID As Integer) As Integer
@ -23,7 +25,7 @@
Dim enumerator1 As New clsWindowApi
'Jedes Formularwindow durchlaufen
For Each top As clsWindowApi.ApiWindow In enumerator1.GetTopLevelWindows()
If LogErrorsOnly = False Then ClassLogger.Add(" ... top-window Name: " & top.MainWindowTitle, False)
If LogErrorsOnly = False Then clsLogger.Add(" ... top-window Name: " & top.MainWindowTitle, False)
If top.MainWindowTitle.Contains(windowname) Or top.MainWindowTitle.ToLower = windowname.ToLower Then
Console.WriteLine(top.MainWindowTitle)
Return False
@ -31,7 +33,7 @@
Next top
Catch ex As Exception
MsgBox("Error in IsRelevantWindowt:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
ClassLogger.Add(">> Error in IsRelevantWindow:" & ex.Message, False)
clsLogger.Add(">> Error in IsRelevantWindow:" & ex.Message, False)
Return False
End Try
End Function

View File

@ -165,7 +165,7 @@ Public Class frmAdministration
Private Sub TimerTest_Tick(sender As Object, e As EventArgs) Handles TimerTest.Tick
clsWINDOWSApi.Get_ForegroundWindow_Info()
If PID <> PROC_PID Then
If PID <> PROC_PID And PROC_Name <> "DD_Clipboard_Searcher" Then
PictureBox1.Visible = True
PID = PROC_PID
txtPID.Text = PROC_PID
@ -197,7 +197,8 @@ Public Class frmAdministration
MsgBox("Could not insert the Process-Profile-Link....Check the logfile!", MsgBoxStyle.Exclamation)
End If
End If
Load_Profile_Process
Load_Profile_Process()
clsHotkey.Refresh_Profile_Links()
Catch ex As Exception
MsgBox("Unexpected Error while adding Process-Profile-link: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try

View File

@ -150,7 +150,7 @@ Public Class frmConfig_Basic
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Process.Start(ClassLogger.DateiSpeicherort)
Process.Start(System.IO.Path.GetDirectoryName(LOGGER_FILEPATH))
End Sub
Private Sub chkLogErrorsOnly_CheckedChanged(sender As Object, e As EventArgs) Handles chkLogErrorsOnly.CheckedChanged

View File

@ -24,27 +24,31 @@ Partial Class frmMain
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain))
Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)
Me.NotifyIconMain = New System.Windows.Forms.NotifyIcon(Me.components)
Me.cmstrpNotifyIcon = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.tsmiChangeState = New System.Windows.Forms.ToolStripMenuItem()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.tslblUser = New System.Windows.Forms.ToolStripStatusLabel()
Me.TimerClose = New System.Windows.Forms.Timer(Me.components)
Me.ContextMenuStripForm = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.MinimierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.btnAdminConfig = New System.Windows.Forms.Button()
Me.btnUserConfig = New System.Windows.Forms.Button()
Me.TimerClose = New System.Windows.Forms.Timer(Me.components)
Me.Label1 = New System.Windows.Forms.Label()
Me.cmstrpNotifyIcon.SuspendLayout()
Me.StatusStrip1.SuspendLayout()
Me.ContextMenuStripForm.SuspendLayout()
Me.SuspendLayout()
'
'NotifyIcon1
'NotifyIconMain
'
Me.NotifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info
Me.NotifyIcon1.BalloonTipText = "Text"
Me.NotifyIcon1.BalloonTipTitle = "Title"
Me.NotifyIcon1.ContextMenuStrip = Me.cmstrpNotifyIcon
Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon)
Me.NotifyIcon1.Text = "Digital Data Clipboard Searcher for windream"
Me.NotifyIcon1.Visible = True
Me.NotifyIconMain.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info
Me.NotifyIconMain.BalloonTipText = "Text"
Me.NotifyIconMain.BalloonTipTitle = "Title"
Me.NotifyIconMain.ContextMenuStrip = Me.cmstrpNotifyIcon
Me.NotifyIconMain.Icon = CType(resources.GetObject("NotifyIconMain.Icon"), System.Drawing.Icon)
Me.NotifyIconMain.Text = "Digital Data Clipboard Searcher for windream"
Me.NotifyIconMain.Visible = True
'
'cmstrpNotifyIcon
'
@ -63,9 +67,9 @@ Partial Class frmMain
'StatusStrip1
'
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tslblUser})
Me.StatusStrip1.Location = New System.Drawing.Point(0, 99)
Me.StatusStrip1.Location = New System.Drawing.Point(0, 88)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Size = New System.Drawing.Size(455, 22)
Me.StatusStrip1.Size = New System.Drawing.Size(465, 22)
Me.StatusStrip1.TabIndex = 3
Me.StatusStrip1.Text = "StatusStrip1"
'
@ -75,6 +79,23 @@ Partial Class frmMain
Me.tslblUser.Name = "tslblUser"
Me.tslblUser.Size = New System.Drawing.Size(16, 17)
'
'TimerClose
'
Me.TimerClose.Interval = 10000
'
'ContextMenuStripForm
'
Me.ContextMenuStripForm.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.MinimierenToolStripMenuItem})
Me.ContextMenuStripForm.Name = "ContextMenuStripForm"
Me.ContextMenuStripForm.Size = New System.Drawing.Size(136, 26)
'
'MinimierenToolStripMenuItem
'
Me.MinimierenToolStripMenuItem.Image = Global.DD_Clipboard_Searcher.My.Resources.Resources.ReduceSize
Me.MinimierenToolStripMenuItem.Name = "MinimierenToolStripMenuItem"
Me.MinimierenToolStripMenuItem.Size = New System.Drawing.Size(135, 22)
Me.MinimierenToolStripMenuItem.Text = "Minimieren"
'
'btnAdminConfig
'
Me.btnAdminConfig.Image = CType(resources.GetObject("btnAdminConfig.Image"), System.Drawing.Image)
@ -100,15 +121,24 @@ Partial Class frmMain
Me.btnUserConfig.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnUserConfig.UseVisualStyleBackColor = True
'
'TimerClose
'Label1
'
Me.TimerClose.Interval = 10000
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(12, 44)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(253, 26)
Me.Label1.TabIndex = 7
Me.Label1.Text = "Inaktivieren des Watchers über Rechtsklick Systray" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "oder Tastaturkombination Strg" & _
" + T"
'
'frmMain
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(455, 121)
Me.ClientSize = New System.Drawing.Size(465, 110)
Me.ContextMenuStrip = Me.ContextMenuStripForm
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.btnAdminConfig)
Me.Controls.Add(Me.StatusStrip1)
Me.Controls.Add(Me.btnUserConfig)
@ -123,17 +153,21 @@ Partial Class frmMain
Me.cmstrpNotifyIcon.ResumeLayout(False)
Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout()
Me.ContextMenuStripForm.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents btnUserConfig As System.Windows.Forms.Button
Friend WithEvents NotifyIcon1 As System.Windows.Forms.NotifyIcon
Friend WithEvents NotifyIconMain As System.Windows.Forms.NotifyIcon
Friend WithEvents cmstrpNotifyIcon As System.Windows.Forms.ContextMenuStrip
Friend WithEvents tsmiChangeState As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip
Friend WithEvents tslblUser As System.Windows.Forms.ToolStripStatusLabel
Friend WithEvents btnAdminConfig As System.Windows.Forms.Button
Friend WithEvents TimerClose As System.Windows.Forms.Timer
Friend WithEvents ContextMenuStripForm As System.Windows.Forms.ContextMenuStrip
Friend WithEvents MinimierenToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents Label1 As System.Windows.Forms.Label
End Class

View File

@ -117,14 +117,14 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="NotifyIcon1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="NotifyIconMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="cmstrpNotifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="NotifyIcon1.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="NotifyIconMain.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAMAEBAQAAEABAAoAQAANgAAABAQAAABAAgAaAUAAF4BAAAQEAAAAQAgAGgEAADGBgAAKAAAABAA
AAAgAAAAAQAEAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIAAAACAgACAAAAAgACAAICA
@ -177,7 +177,7 @@
</value>
</data>
<metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>383, 17</value>
<value>278, 17</value>
</metadata>
<data name="tslblUser.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@ -190,6 +190,12 @@
1iOdbmae7IkqFqH2AAAAAElFTkSuQmCC
</value>
</data>
<metadata name="TimerClose.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>395, 17</value>
</metadata>
<metadata name="ContextMenuStripForm.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>507, 17</value>
</metadata>
<data name="btnAdminConfig.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
@ -209,9 +215,6 @@
SUVORK5CYII=
</value>
</data>
<metadata name="TimerClose.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>500, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAMAEBAQAAEABAAoAQAANgAAABAQAAABAAgAaAUAAF4BAAAQEAAAAQAgAGgEAADGBgAAKAAAABAA

View File

@ -1,6 +1,8 @@
Imports System.Threading
Imports DD_LIB_Standards
Public Class frmMain
Dim WithEvents Hotkey As New clsHotkey(Me)
Private PID As Integer
Private WithEvents _Watcher As ClipboardWatcher = ClipboardWatcher.Singleton
Private Sub frmClipboardWatch_Disposed(ByVal sender As Object, _
@ -11,7 +13,11 @@ Public Class frmMain
Private Sub _Watcher_Changed(ByVal sender As Object, _
ByVal e As EventArgs) Handles _Watcher.Changed
If MONITORING_ACTIVE = False Then Exit Sub
If MONITORING_ACTIVE = False Then
NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Clipboard-watcher is inactive.", ToolTipIcon.Info)
Exit Sub
End If
Dim Data As IDataObject = Clipboard.GetDataObject
' Dim RelevantWindow = clsWINDOWSApi.IsRelevantWindow("jonathan")
@ -23,28 +29,35 @@ Public Class frmMain
'End With
Dim found As Boolean = False
CLIPBOARD_TEXT = Clipboard.GetText
If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >>{0} - Clipboard-Watcher fired for process '{1}'", Now.ToString, PROC_Name), False)
For Each row As DataRow In DT_USER_PROFILES.Rows
If found = True Then Exit For
If PROC_Name.ToUpper = row.Item("PROC_NAME").ToString.ToUpper Then
Dim regex_expression = row.Item("REGEX_EXPRESSION")
Dim regex As New System.Text.RegularExpressions.Regex(regex_expression)
Dim match As System.Text.RegularExpressions.Match = regex.Match(CLIPBOARD_TEXT)
If match.Success Then
If match.Groups(0).Value <> CURR_MATCH_RESULT Then
CURR_MATCH_RESULT = match.Groups(0).Value
If Not IsNothing(CURR_MATCH_RESULT) Then
clsSearch.RUN_WD_SEARCH(row.Item("WD_SEARCH"))
found = True
End If
Else
Exit For
End If
Else
If found = False Then
' If match.Groups(0).Value <> CURR_MATCH_RESULT Then
CURR_MATCH_RESULT = match.Groups(0).Value
If Not IsNothing(CURR_MATCH_RESULT) Then
clsSearch.RUN_WD_SEARCH(row.Item("WD_SEARCH"))
found = True
End If
'Else
' NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", String.Format("Clipboard Watcher fired but Clipboardcontent is equal: '{0}'", CURR_MATCH_RESULT), ToolTipIcon.Info)
' If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >> {0} - Equal Clipboard-result '{1}'", Now.ToString, CURR_MATCH_RESULT), False)
' Exit For
'End If
Else
If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >> {0} - No regex-match for cliboardtext '{1}'", Now.ToString, match.Groups(0).Value), False)
End If
End If
Next
If found = False Then
If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >> {0} - Process '{1}' not configured!", Now.ToString, PROC_Name), False)
End If
End Sub
Public Sub New()
@ -71,7 +84,7 @@ Public Class frmMain
End Sub
Private Sub frmMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
ClassLogger.Add(">> Logout time: " & Now.ToString, False)
clsLogger.Add(">> Logout time: " & Now.ToString, False)
If ERROR_INIT = "INVALID USER" Then
Exit Sub
End If
@ -85,6 +98,11 @@ Public Class frmMain
Catch ex As Exception
End Try
Try
Hotkey.RemoveHotKey(354522017)
Catch ex As Exception
End Try
'TempDateien löschen
Try
@ -95,23 +113,31 @@ Public Class frmMain
End Try
If clsLogger.LOGG_MSG <> String.Empty Then
ClassLogger.Add(clsLogger.LOGG_MSG, False)
clsLogger.Add(clsLogger.LOGG_MSG, False)
End If
End Sub
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
ClassWindowLocation.LoadFormLocationSize(Me)
If clsDatabase.DB_DEFAULT_INITIALIZED = True Then
Me.NotifyIcon1.Visible = True
Dim sql = String.Format("SELECT T.*, T2.PROC_NAME FROM TBCBS_PROFILES T, TBCBS_USER_PROFILE T1, TBCBS_PROFILE_PROCESS T2 WHERE T.GUID = T1.PROFILE_ID AND T.GUID = T2.PROFILE_ID AND T1.USER_ID = {0}", USER_GUID)
DT_USER_PROFILES = clsDatabase.Return_Datatable(sql)
If DT_USER_PROFILES.Rows.Count = 0 Then
MsgBox("Es wurden noch keine Profile für diesen User hinterlegt!", MsgBoxStyle.Exclamation)
End If
Me.NotifyIconMain.Visible = True
clsHotkey.Refresh_Profile_Links()
Hotkey.AddHotKey(Keys.T, clsHotkey.MODKEY.MOD_CONTROL, 354522017)
End If
tslblUser.Text = USER_USERNAME
End Sub
Private Sub ReceiveHotKey(ByVal HotKeyID As String) Handles Hotkey.HotKeyPressed
Change_Monitoring_State()
End Sub
Sub Change_Monitoring_State()
If MONITORING_ACTIVE = True Then
NotifyIconMain.ShowBalloonTip(30000, "Clipboard Watcher", "Clipboard-Watcher wurde inaktiviert!", ToolTipIcon.Info)
MONITORING_ACTIVE = False
Else
MONITORING_ACTIVE = True
NotifyIconMain.ShowBalloonTip(30000, "Clipboard Watcher", "Clipboard-Watcher wurde wieder aktiviert!", ToolTipIcon.Info)
End If
End Sub
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
If ERROR_INIT <> "INVALID USER" And LICENSE_COUNT > 0 Then
If DT_USER_PROFILES.Rows.Count >= 1 Then
@ -130,14 +156,14 @@ Public Class frmMain
End If
End Sub
Private Sub NotifyIcon1_DoubleClick(sender As Object, e As EventArgs) Handles NotifyIcon1.DoubleClick
Private Sub NotifyIcon1_DoubleClick(sender As Object, e As EventArgs) Handles NotifyIconMain.DoubleClick
If Me.Visible = False Then
Me.BringToFront()
Me.Visible = True
TimerClose.Start()
Else
Me.Hide()
NotifyIcon1.Visible = True
NotifyIconMain.Visible = True
End If
End Sub
@ -153,11 +179,13 @@ Public Class frmMain
tsmiChangeState.Image = My.Resources.control_start_blue
tsmiChangeState.Text = "Überwachung Clipboard starten"
MONITORING_ACTIVE = False
NotifyIconMain.ShowBalloonTip(30000, "Clipboard Watcher", "Clipboard-Watcher wurde inaktiviert!", ToolTipIcon.Info)
Else
tsmiChangeState.Image = My.Resources.StatusAnnotations_Stop_16xLG
tsmiChangeState.Tag = "stop"
tsmiChangeState.Text = "Überwachung Clipboard stoppen"
MONITORING_ACTIVE = True
NotifyIconMain.ShowBalloonTip(30000, "Clipboard Watcher", "Clipboard-Watcher wurde wieder aktiviert!", ToolTipIcon.Info)
End If
End Sub
'Private Sub Timer1_Tick(sender As Object, e As EventArgs)
@ -192,4 +220,8 @@ Public Class frmMain
End If
End Sub
Private Sub MinimierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MinimierenToolStripMenuItem.Click
Me.Hide()
End Sub
End Class

View File

@ -38,4 +38,5 @@
Public PROC_PID As String
Public PROC_Name As String
Public PROC_WindowTitle As String
Public LOGGER_FILEPATH As String
End Module

View File

@ -61,6 +61,18 @@
<File Id="DDLibStandarts" Name="DD_LIB_Standards.dll" KeyPath="yes" Checksum="yes"/>
</Component>
<!-- DEVEXPRESS Bibliotheken -->
<Component Id="DevExpressLibs" Guid="665D0AC8-93FC-4499-BA89-F660CAC6C577">
<File Id="DevExpress.Data.v15.2" Name="DevExpress.Data.v15.2.dll" Source="D:\Programme\Sprachen\DevExpress 15.2\Components\Bin\Framework\DevExpress.Data.v15.2.dll" KeyPath="yes" />
<File Id="DevExpress.Printing.v15.2.Core" Name="DevExpress.Printing.v15.2.Core.dll" Source="D:\Programme\Sprachen\DevExpress 15.2\Components\Bin\Framework\DevExpress.Printing.v15.2.Core.dll" />
<File Id="DevExpress.Sparkline.v15.2.Core" Name="DevExpress.Sparkline.v15.2.Core.dll" Source="D:\Programme\Sprachen\DevExpress 15.2\Components\Bin\Framework\DevExpress.Sparkline.v15.2.Core.dll" />
<File Id="DevExpress.Utils.v15.2" Name="DevExpress.Utils.v15.2.dll" Source="D:\Programme\Sprachen\DevExpress 15.2\Components\Bin\Framework\DevExpress.Utils.v15.2.dll" />
<File Id="DevExpress.XtraEditors.v15.2" Name="DevExpress.XtraEditors.v15.2.dll" Source="D:\Programme\Sprachen\DevExpress 15.2\Components\Bin\Framework\DevExpress.XtraEditors.v15.2.dll" />
<File Id="DevExpress.XtraGrid.v15.2" Name="DevExpress.XtraGrid.v15.2.dll" Source="D:\Programme\Sprachen\DevExpress 15.2\Components\Bin\Framework\DevExpress.XtraGrid.v15.2.dll" />
<File Id="DevExpress.XtraLayout.v15.2" Name="DevExpress.XtraLayout.v15.2.dll" Source="D:\Programme\Sprachen\DevExpress 15.2\Components\Bin\Framework\DevExpress.XtraLayout.v15.2.dll" />
<File Id="DevExpress.XtraPrinting.v15.2" Name="DevExpress.XtraPrinting.v15.2.dll" Source="D:\Programme\Sprachen\DevExpress 15.2\Components\Bin\Framework\DevExpress.XtraPrinting.v15.2.dll" />
</Component>
<Component Id="RegistryKeys" Guid="{72D6927F-8297-4D51-BF4A-813064089A4A}">
<RegistryKey Root="HKCU" Key="Software">
@ -80,6 +92,7 @@
<ComponentRef Id="MainApplicationExe" />
<ComponentRef Id="MainApplicationExeConfig"/>
<ComponentRef Id="DDLibStandarts"/>
<ComponentRef Id="DevExpressLibs"/>
<ComponentRef Id="RegistryKeys" />
</Feature>