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 Microsoft.VisualBasic.ControlChars
Imports System.Runtime.InteropServices Imports System.Runtime.InteropServices
Imports DD_LIB_Standards
Public Class ClipboardWatcher : Inherits NativeWindow : Implements IDisposable Public Class ClipboardWatcher : Inherits NativeWindow : Implements IDisposable
<DllImport("user32", EntryPoint:="SetClipboardViewer")> _ <DllImport("user32", EntryPoint:="SetClipboardViewer")> _
@ -26,7 +27,7 @@ Public Class ClipboardWatcher : Inherits NativeWindow : Implements IDisposable
'Dim CapTxt As String = clsWINDOWSApi.GetCaption() 'Dim CapTxt As String = clsWINDOWSApi.GetCaption()
If IsNothing(PROC_Name) Then Exit Sub If IsNothing(PROC_Name) Then Exit Sub
If PROC_Name.StartsWith("DD_Clipboard_Searcher") 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 ' If CapTxt.ToUpper.StartsWith("DD") Then Exit Sub
RaiseEvent Changed(Me, EventArgs.Empty) RaiseEvent Changed(Me, EventArgs.Empty)
End Select End Select

View File

@ -1,9 +1,24 @@
Imports System.ComponentModel Imports System.ComponentModel
Imports DD_LIB_Standards Imports DD_LIB_Standards
Imports System.IO
Public Class ClassInit Public Class ClassInit
Public _lizenzManager As clsLicenseManager Public _lizenzManager As clsLicenseManager
Public Sub InitLogger() 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 End Sub
Public Function InitDatabase() Public Function InitDatabase()
Dim dbResult As Boolean Dim dbResult As Boolean
@ -42,11 +57,11 @@ Public Class ClassInit
USER_USERNAME = _User USER_USERNAME = _User
End If End If
Dim sql = String.Format("SELECT * FROM TBDD_USER WHERE (LOWER(USERNAME) = LOWER('{0}'))", USER_USERNAME) Dim sql = String.Format("SELECT * FROM TBDD_USER WHERE (LOWER(USERNAME) = LOWER('{0}'))", USER_USERNAME)
ClassLogger.Add(">> Login time: " & Now.ToString, False) clsLogger.Add(">> Login Username: " & USER_USERNAME, False)
ClassLogger.Add(">> Username: " & USER_USERNAME, False) clsLogger.Add(">> Login time: " & Now.ToString, False)
Dim USER_DT As DataTable = clsDatabase.Return_Datatable(sql, True) Dim USER_DT As DataTable = clsDatabase.Return_Datatable(sql, True)
If USER_DT.Rows.Count = 0 Then 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:") 'MsgBox("Achtung: Sie sind nicht in der Userverwaltung hinterlegt." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:")
'Me.Close() 'Me.Close()
Dim msg = String.Format("You are not listed in the Useradministration." & vbNewLine & "Please contact the admin.") 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_GUID = USER_DT.Rows(0).Item("GUID")
USER_LANGUAGE = USER_DT.Rows(0).Item("LANGUAGE") 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) 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
Dim Access_right As Boolean = USER_DT.Rows(0).Item("MODULE_DDCBSEARCHER") 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
If Access_right = False Then 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:") '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!") 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) 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) Dim anzahl = clsDatabase.Execute_Scalar(sql)
USERS_LOGGED_IN = CInt(anzahl) 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 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!") "Number of licenses: " & LICENSE_COUNT.ToString & vbNewLine & "Please contact Your admin!")
End If End If
MsgBox(msg, MsgBoxStyle.Exclamation) 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 If USER_IS_ADMIN = False Then
'Anmeldung wieder herausnehmen 'Anmeldung wieder herausnehmen
sql = "DELETE FROM TBDD_USER_MODULE_LOG_IN WHERE USER_ID = " & USER_GUID & " AND MODULE= 'Clipboard-Searcher'" sql = "DELETE FROM TBDD_USER_MODULE_LOG_IN WHERE USER_ID = " & USER_GUID & " AND MODULE= 'Clipboard-Searcher'"
clsDatabase.Execute_non_Query(sql, True) clsDatabase.Execute_non_Query(sql, True)
ClassLogger.Add(" - logged out the user", False) clsLogger.Add(" - logged out the user", False)
Return False Return False
End If End If
End If End If
@ -127,7 +151,7 @@ Public Class ClassInit
End If End If
End If End If
Catch ex As Exception 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) MsgBox("Unexpected Error in InitUserLogin: " & ex.Message, MsgBoxStyle.Critical)
Return False Return False
End Try End Try

View File

@ -1,5 +1,6 @@
Imports System.Xml Imports System.Xml
Imports System.IO Imports System.IO
Imports DD_LIB_Standards
Public Class ClassWindowLocation Public Class ClassWindowLocation
@ -35,7 +36,7 @@ Public Class ClassWindowLocation
End Select End Select
If x = 5000 Then If x = 5000 Then
form.WindowState = FormWindowState.Maximized form.WindowState = FormWindowState.Maximized
Else Else
If x > 0 Then If x > 0 Then
form.Location = New Point(x, y) form.Location = New Point(x, y)
@ -46,7 +47,7 @@ Public Class ClassWindowLocation
Next Next
Catch notFoundEx As System.IO.FileNotFoundException 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 Catch ex As Exception
MsgBox("Error while loading Window Position!" & vbNewLine & ex.Message, MsgBoxStyle.Critical) MsgBox("Error while loading Window Position!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try End Try
@ -81,7 +82,7 @@ Public Class ClassWindowLocation
layout.Save(settings) layout.Save(settings)
Catch notFoundEx As System.IO.FileNotFoundException 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 Catch ex As Exception
MsgBox("Error while saving Window Position!" & vbNewLine & ex.Message, MsgBoxStyle.Critical) MsgBox("Error while saving Window Position!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try 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="Class1.vb" />
<Compile Include="ClassInit.vb" /> <Compile Include="ClassInit.vb" />
<Compile Include="ClassLayout.vb" /> <Compile Include="ClassLayout.vb" />
<Compile Include="ClassLogger.vb" /> <Compile Include="clsHotkey.vb" />
<Compile Include="clsLicense.vb" /> <Compile Include="clsLicense.vb" />
<Compile Include="clsSearch.vb" /> <Compile Include="clsSearch.vb" />
<Compile Include="clsWindowApivb.vb" /> <Compile Include="clsWindowApivb.vb" />
@ -218,6 +218,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="KeyOutput_8167.ico" /> <Content Include="KeyOutput_8167.ico" />
<None Include="Resources\ReduceSize.png" />
<None Include="Resources\KeyOutput_8167.png" /> <None Include="Resources\KeyOutput_8167.png" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />

View File

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

View File

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

View File

@ -120,6 +120,16 @@ Namespace My.Resources
End Get End Get
End Property 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> '''<summary>
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''</summary> '''</summary>

View File

@ -121,22 +121,25 @@
<data name="GoToDefinition_5575" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> <value>..\Resources\GoToDefinition_5575.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </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"> <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> <value>..\Resources\StatusAnnotations_Stop_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </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"> <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> <value>..\Resources\KeyDown_8461.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="folder_Open_16xLG" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> <value>..\Resources\folder_Open_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="control_start_blue" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Annotation_New" 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> <value>..\Resources\Annotation_New.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="KeyOutput_8167" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ReduceSize" 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> <value>..\Resources\ReduceSize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
</root> </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> <summary>
Build the ApiWindow object to hold information about the Window object. Build the ApiWindow object to hold information about the Window object.
</summary> </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"> </member><member name="P:DD_Clipboard_Searcher.My.Resources.Resources.ResourceManager">
<summary> <summary>
Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. 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> <summary>
Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
</summary> </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"> </member><member name="P:DD_Clipboard_Searcher.My.Resources.Resources.StatusAnnotations_Stop_16xLG">
<summary> <summary>
Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. 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 DD_LIB_Standards
Imports System.IO Imports System.IO
Imports System.Text Imports System.Text
Imports System.Runtime.InteropServices
Public Class clsSearch 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 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 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 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 Private Structure RECT
Dim Left As Integer Dim Left As Integer
@ -23,7 +27,7 @@ Public Class clsSearch
Dim extension = Path.GetExtension(BaseSearch) Dim extension = Path.GetExtension(BaseSearch)
Dim windream_temp_search As String = "" Dim windream_temp_search As String = ""
If IO.File.Exists(BaseSearch) = False Then 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) MsgBox("Die Windream-Suche existiert nicht oder ist nicht zugreifbar!", MsgBoxStyle.Critical)
Return Nothing Return Nothing
End If End If
@ -43,15 +47,15 @@ Public Class clsSearch
If WD_UNICODE = True Then If WD_UNICODE = True Then
EncodingFormat = Encoding.GetEncoding(1252) '1252 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 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) EncodingFormat = Encoding.GetEncoding(65001)
End If 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 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("Í", "Ö")
fileContents = fileContents.Replace("@Clipboard", CURR_MATCH_RESULT) fileContents = fileContents.Replace("@Clipboard", CURR_MATCH_RESULT)
fileContents = fileContents.Replace("@CLIPBOARD", CURR_MATCH_RESULT) fileContents = fileContents.Replace("@CLIPBOARD", CURR_MATCH_RESULT)
@ -63,7 +67,7 @@ Public Class clsSearch
Try Try
'Die File schreiben 'Die File schreiben
My.Computer.FileSystem.WriteAllText(windream_temp_search, fileContents, False, EncodingFormat) 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 ' XML-Datei öffnen und laden
Dim Stream As New IO.StreamReader(CStr(windream_temp_search), EncodingFormat) Dim Stream As New IO.StreamReader(CStr(windream_temp_search), EncodingFormat)
Dim Reader As New System.Xml.XmlTextReader(Stream) Dim Reader As New System.Xml.XmlTextReader(Stream)
@ -74,9 +78,9 @@ Public Class clsSearch
xml.Load(Reader) xml.Load(Reader)
Reader.Close() Reader.Close()
xml.Save(windream_temp_search) 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 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:") MsgBox(ex.Message, MsgBoxStyle.Critical, "Unerwarteter Fehler in Write XmlSearch:")
End Try End Try
@ -98,14 +102,14 @@ Public Class clsSearch
Dim rctMain As RECT Dim rctMain As RECT
GetWindowRect(p.MainWindowHandle, rctMain) GetWindowRect(p.MainWindowHandle, rctMain)
If LogErrorsOnly = False Then If LogErrorsOnly = False Then
ClassLogger.Add(" ...Top-Position: " & rctMain.Top.ToString, False) clsLogger.Add(" ...Top-Position: " & rctMain.Top.ToString, False)
ClassLogger.Add(" ...Left-Position: " & rctMain.Left.ToString, False) clsLogger.Add(" ...Left-Position: " & rctMain.Left.ToString, False)
ClassLogger.Add(" ...Right-Position: " & rctMain.Right.ToString, False) clsLogger.Add(" ...Right-Position: " & rctMain.Right.ToString, False)
ClassLogger.Add(" ...Bottom-Position: " & rctMain.Bottom.ToString, False) clsLogger.Add(" ...Bottom-Position: " & rctMain.Bottom.ToString, False)
End If End If
Catch ex As Exception Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Ausführen der windream-Suche:") 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" Return "Unexpected error while executing search"
End Try End Try
Dim psList() As Process Dim psList() As Process
@ -123,23 +127,23 @@ Public Class clsSearch
ShowWindow(p.MainWindowHandle, 3) ' SW_MAXIMIZE ShowWindow(p.MainWindowHandle, 3) ' SW_MAXIMIZE
End If End If
End If End If
' SetForeGroundWindow( p.MainWindowHandle) SetForegroundWindow(p.MainWindowHandle)
End If End If
Next p Next p
Catch ex As Exception 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 End Try
Return "" Return ""
Catch ex As Exception 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) MsgBox("Error in Create Search:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return "Unexpected error in Create Search" Return "Unexpected error in Create Search"
End Try End Try
Catch ex As Exception 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) MsgBox("Error in RUN_WD_SEARCH:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return "Unerwarteter Unexpected error in RUN_WD_SEARCH" Return "Unerwarteter Unexpected error in RUN_WD_SEARCH"
End Try 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 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 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 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 Dim enumerator1 As New clsWindowApi
'Jedes Formularwindow durchlaufen 'Jedes Formularwindow durchlaufen
For Each top As clsWindowApi.ApiWindow In enumerator1.GetTopLevelWindows() 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 If top.MainWindowTitle.Contains(windowname) Or top.MainWindowTitle.ToLower = windowname.ToLower Then
Console.WriteLine(top.MainWindowTitle) Console.WriteLine(top.MainWindowTitle)
Return False Return False
@ -31,7 +33,7 @@
Next top Next top
Catch ex As Exception Catch ex As Exception
MsgBox("Error in IsRelevantWindowt:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) 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 Return False
End Try End Try
End Function End Function
@ -66,5 +68,5 @@
msg &= vbNewLine & TitleLength.ToString msg &= vbNewLine & TitleLength.ToString
' MsgBox(msg) ' MsgBox(msg)
End Sub End Sub
End Class End Class

View File

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

View File

@ -1,199 +1,199 @@
Imports System.Threading Imports System.Threading
Imports System.Globalization Imports System.Globalization
Imports DD_LIB_Standards Imports DD_LIB_Standards
Public Class frmConfig_Basic Public Class frmConfig_Basic
Dim formloaded As Boolean = False Dim formloaded As Boolean = False
Private Sub BtnConnect_Click(sender As Object, e As EventArgs) Handles BtnConnect.Click Private Sub BtnConnect_Click(sender As Object, e As EventArgs) Handles BtnConnect.Click
Try Try
Dim con As String Dim con As String
If chkbxUserAut.Checked Then If chkbxUserAut.Checked Then
con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";Trusted_Connection=True;" con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";Trusted_Connection=True;"
Else Else
con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";" con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";"
End If End If
Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString) Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString)
'während Verbindungsaufbau Sanduhr-Mauszeiger 'während Verbindungsaufbau Sanduhr-Mauszeiger
Cursor = Cursors.WaitCursor Cursor = Cursors.WaitCursor
connection.Open() connection.Open()
Cursor = Cursors.Default Cursor = Cursors.Default
'DialogResult = Windows.Forms.DialogResult.OK 'DialogResult = Windows.Forms.DialogResult.OK
Dim result As MsgBoxResult Dim result As MsgBoxResult
Dim msg = "Die Verbindung wurde erfolgreich aufgebaut!" & vbNewLine & "Möchten Sie diese Verbindung nun in der Anwendung speichern?" Dim msg = "Die Verbindung wurde erfolgreich aufgebaut!" & vbNewLine & "Möchten Sie diese Verbindung nun in der Anwendung speichern?"
If USER_LANGUAGE <> "de-DE" Then If USER_LANGUAGE <> "de-DE" Then
msg = "Connection was successfully opened!" & vbNewLine & "Would You like to save it?" msg = "Connection was successfully opened!" & vbNewLine & "Would You like to save it?"
End If End If
result = MessageBox.Show(msg, "Database-Connection", MessageBoxButtons.YesNo, MessageBoxIcon.Question) result = MessageBox.Show(msg, "Database-Connection", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then If result = MsgBoxResult.Yes Then
CONNECTION_CHANGED = True CONNECTION_CHANGED = True
'Set the construction string 'Set the construction string
MyConnectionString = con 'csb.ConnectionString MyConnectionString = con 'csb.ConnectionString
clsDatabase.Init(MyConnectionString) clsDatabase.Init(MyConnectionString)
My.Settings.Save() My.Settings.Save()
If chkbxUserAut.Checked = False Then If chkbxUserAut.Checked = False Then
Dim wrapper As New clsEncryption("!35452didalog=") Dim wrapper As New clsEncryption("!35452didalog=")
Dim cipherText As String = wrapper.EncryptData(Me.txtPasswort.Text) Dim cipherText As String = wrapper.EncryptData(Me.txtPasswort.Text)
Dim pw As String = cipherText Dim pw As String = cipherText
con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & pw & ";" con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & pw & ";"
End If End If
SaveConfigValue("MyConnectionString", con) SaveConfigValue("MyConnectionString", con)
Dim csb As New SqlClient.SqlConnectionStringBuilder Dim csb As New SqlClient.SqlConnectionStringBuilder
csb.ConnectionString = MyConnectionString csb.ConnectionString = MyConnectionString
Dim constr = connection.ConnectionString Dim constr = connection.ConnectionString
If chkbxUserAut.Checked = False Then If chkbxUserAut.Checked = False Then
constr = constr.Replace(csb.Password, "XXXXX") constr = constr.Replace(csb.Password, "XXXXX")
End If End If
Me.txtActualConnection.Text = constr Me.txtActualConnection.Text = constr
End If End If
Catch ex As Exception Catch ex As Exception
Cursor = Cursors.Default Cursor = Cursors.Default
MsgBox("Error in Connectionbuild: " & vbNewLine & ex.Message, MsgBoxStyle.Exclamation) MsgBox("Error in Connectionbuild: " & vbNewLine & ex.Message, MsgBoxStyle.Exclamation)
End Try End Try
End Sub End Sub
Private Sub cmbDatenbank_MouseClick(sender As Object, e As MouseEventArgs) Handles cmbDatenbank.MouseClick Private Sub cmbDatenbank_MouseClick(sender As Object, e As MouseEventArgs) Handles cmbDatenbank.MouseClick
Load_Databases() Load_Databases()
End Sub End Sub
Sub Load_Databases() Sub Load_Databases()
Try Try
Me.Cursor = Cursors.WaitCursor Me.Cursor = Cursors.WaitCursor
Dim csb As New SqlClient.SqlConnectionStringBuilder Dim csb As New SqlClient.SqlConnectionStringBuilder
csb.DataSource = Me.txtServer.Text csb.DataSource = Me.txtServer.Text
csb.IntegratedSecurity = False csb.IntegratedSecurity = False
csb.UserID = Me.txtUser.Text csb.UserID = Me.txtUser.Text
csb.Password = Me.txtPasswort.Text csb.Password = Me.txtPasswort.Text
Dim con As String Dim con As String
If chkbxUserAut.Checked Then If chkbxUserAut.Checked Then
con = "Data Source=" & Me.txtServer.Text & ";Trusted_Connection=True;" con = "Data Source=" & Me.txtServer.Text & ";Trusted_Connection=True;"
Else Else
'con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";" 'con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";"
con = "Server=" & Me.txtServer.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";" con = "Server=" & Me.txtServer.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";"
End If End If
Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString) Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString)
connection.Open() connection.Open()
Dim cmd As New SqlClient.SqlCommand("sp_databases", connection) Dim cmd As New SqlClient.SqlCommand("sp_databases", connection)
cmd.CommandType = CommandType.StoredProcedure cmd.CommandType = CommandType.StoredProcedure
' Ausführen und Ergebnis in einer ListBox anzeigen ' Ausführen und Ergebnis in einer ListBox anzeigen
Dim dr As SqlClient.SqlDataReader = cmd.ExecuteReader Dim dr As SqlClient.SqlDataReader = cmd.ExecuteReader
If dr.HasRows Then If dr.HasRows Then
cmbDatenbank.Items.Clear() cmbDatenbank.Items.Clear()
Do While dr.Read Do While dr.Read
cmbDatenbank.Items.Add(dr("Database_Name")) cmbDatenbank.Items.Add(dr("Database_Name"))
Loop Loop
cmbDatenbank.DroppedDown = True cmbDatenbank.DroppedDown = True
Else Else
MsgBox("The standard-databases could not be retrieved. The default database will be set!" & vbNewLine & "Check rights in sql-server for user: " & Me.txtUser.Text, MsgBoxStyle.Exclamation) MsgBox("The standard-databases could not be retrieved. The default database will be set!" & vbNewLine & "Check rights in sql-server for user: " & Me.txtUser.Text, MsgBoxStyle.Exclamation)
End If End If
connection.Close() connection.Close()
Catch ex As Exception Catch ex As Exception
If ex.Message.ToLower.Contains("he standard-databases") Or ex.Message.ToLower.Contains("ie standard-datenbanken") Then If ex.Message.ToLower.Contains("he standard-databases") Or ex.Message.ToLower.Contains("ie standard-datenbanken") Then
cmbDatenbank.Text = "DD_ECM" cmbDatenbank.Text = "DD_ECM"
End If End If
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in Load Databases:") MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in Load Databases:")
End Try End Try
Cursor = Cursors.Default Cursor = Cursors.Default
End Sub End Sub
Private Sub frmConfig_Basic_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing Private Sub frmConfig_Basic_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
End Sub End Sub
Private Sub frmConfig_Basic_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub frmConfig_Basic_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If Not MyConnectionString = String.Empty Then If Not MyConnectionString = String.Empty Then
CONNECTION_CHANGED = False CONNECTION_CHANGED = False
Try Try
Dim csb As New SqlClient.SqlConnectionStringBuilder Dim csb As New SqlClient.SqlConnectionStringBuilder
csb.ConnectionString = MyConnectionString csb.ConnectionString = MyConnectionString
Dim constr = MyConnectionString Dim constr = MyConnectionString
If Not MyConnectionString.Contains("Trusted") Then If Not MyConnectionString.Contains("Trusted") Then
constr = constr.Replace(csb.Password, "XXXXX") constr = constr.Replace(csb.Password, "XXXXX")
txtUser.Text = csb.UserID txtUser.Text = csb.UserID
chkbxUserAut.Checked = False chkbxUserAut.Checked = False
Else Else
chkbxUserAut.Checked = True chkbxUserAut.Checked = True
End If End If
Try Try
txtServer.Text = csb.DataSource txtServer.Text = csb.DataSource
cmbDatenbank.Text = csb.InitialCatalog cmbDatenbank.Text = csb.InitialCatalog
Catch ex As Exception Catch ex As Exception
End Try End Try
Me.txtActualConnection.Text = constr Me.txtActualConnection.Text = constr
chkLogErrorsOnly.Checked = LogErrorsOnly chkLogErrorsOnly.Checked = LogErrorsOnly
Catch ex As Exception Catch ex As Exception
MsgBox("Fehler in FormLoad: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) MsgBox("Fehler in FormLoad: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try End Try
End If End If
End Sub End Sub
Private Sub chkbxloadWDDocs_CheckedChanged(sender As Object, e As EventArgs) Private Sub chkbxloadWDDocs_CheckedChanged(sender As Object, e As EventArgs)
End Sub End Sub
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
' Specify that the link was visited. ' Specify that the link was visited.
Me.LinkLabel1.LinkVisited = True Me.LinkLabel1.LinkVisited = True
' Navigate to a URL. ' Navigate to a URL.
System.Diagnostics.Process.Start("http://www.didalog.de/Support") System.Diagnostics.Process.Start("http://www.didalog.de/Support")
End Sub End Sub
Private Sub btnApplicationFolder_Click(sender As Object, e As EventArgs) Handles btnApplicationFolder.Click Private Sub btnApplicationFolder_Click(sender As Object, e As EventArgs) Handles btnApplicationFolder.Click
Process.Start(Application.UserAppDataPath()) Process.Start(Application.UserAppDataPath())
End Sub End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 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 End Sub
Private Sub chkLogErrorsOnly_CheckedChanged(sender As Object, e As EventArgs) Handles chkLogErrorsOnly.CheckedChanged Private Sub chkLogErrorsOnly_CheckedChanged(sender As Object, e As EventArgs) Handles chkLogErrorsOnly.CheckedChanged
LogErrorsOnly = chkLogErrorsOnly.Checked LogErrorsOnly = chkLogErrorsOnly.Checked
SaveConfigValue("LogErrorsOnly", LogErrorsOnly) SaveConfigValue("LogErrorsOnly", LogErrorsOnly)
End Sub End Sub
Private Sub frmConfig_Basic_Shown(sender As Object, e As EventArgs) Handles Me.Shown Private Sub frmConfig_Basic_Shown(sender As Object, e As EventArgs) Handles Me.Shown
formloaded = True formloaded = True
End Sub End Sub
Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
Select Case TabControl1.SelectedIndex Select Case TabControl1.SelectedIndex
Case 1 Case 1
End Select End Select
End Sub End Sub
Private Sub chkbxUserAut_CheckedChanged(sender As Object, e As EventArgs) Handles chkbxUserAut.CheckedChanged Private Sub chkbxUserAut_CheckedChanged(sender As Object, e As EventArgs) Handles chkbxUserAut.CheckedChanged
If chkbxUserAut.Checked Then If chkbxUserAut.Checked Then
Me.txtPasswort.Enabled = False Me.txtPasswort.Enabled = False
Me.txtUser.Enabled = False Me.txtUser.Enabled = False
Else Else
Me.txtPasswort.Enabled = True Me.txtPasswort.Enabled = True
Me.txtUser.Enabled = True Me.txtUser.Enabled = True
End If End If
End Sub End Sub
Private Sub txtActualConnection_TextChanged(sender As Object, e As EventArgs) Handles txtActualConnection.TextChanged Private Sub txtActualConnection_TextChanged(sender As Object, e As EventArgs) Handles txtActualConnection.TextChanged
End Sub End Sub
Private Sub cmbDatenbank_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbDatenbank.SelectedIndexChanged Private Sub cmbDatenbank_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbDatenbank.SelectedIndexChanged
End Sub End Sub
Private Sub txtPasswort_Leave(sender As Object, e As EventArgs) Handles txtPasswort.Leave Private Sub txtPasswort_Leave(sender As Object, e As EventArgs) Handles txtPasswort.Leave
End Sub End Sub
Private Sub txtPasswort_TextChanged(sender As Object, e As EventArgs) Handles txtPasswort.TextChanged Private Sub txtPasswort_TextChanged(sender As Object, e As EventArgs) Handles txtPasswort.TextChanged
End Sub End Sub
End Class End Class

View File

@ -24,27 +24,31 @@ Partial Class frmMain
Private Sub InitializeComponent() Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container() Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain)) 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.cmstrpNotifyIcon = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.tsmiChangeState = New System.Windows.Forms.ToolStripMenuItem() Me.tsmiChangeState = New System.Windows.Forms.ToolStripMenuItem()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.tslblUser = New System.Windows.Forms.ToolStripStatusLabel() 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.btnAdminConfig = New System.Windows.Forms.Button()
Me.btnUserConfig = 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.cmstrpNotifyIcon.SuspendLayout()
Me.StatusStrip1.SuspendLayout() Me.StatusStrip1.SuspendLayout()
Me.ContextMenuStripForm.SuspendLayout()
Me.SuspendLayout() Me.SuspendLayout()
' '
'NotifyIcon1 'NotifyIconMain
' '
Me.NotifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info Me.NotifyIconMain.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info
Me.NotifyIcon1.BalloonTipText = "Text" Me.NotifyIconMain.BalloonTipText = "Text"
Me.NotifyIcon1.BalloonTipTitle = "Title" Me.NotifyIconMain.BalloonTipTitle = "Title"
Me.NotifyIcon1.ContextMenuStrip = Me.cmstrpNotifyIcon Me.NotifyIconMain.ContextMenuStrip = Me.cmstrpNotifyIcon
Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon) Me.NotifyIconMain.Icon = CType(resources.GetObject("NotifyIconMain.Icon"), System.Drawing.Icon)
Me.NotifyIcon1.Text = "Digital Data Clipboard Searcher for windream" Me.NotifyIconMain.Text = "Digital Data Clipboard Searcher for windream"
Me.NotifyIcon1.Visible = True Me.NotifyIconMain.Visible = True
' '
'cmstrpNotifyIcon 'cmstrpNotifyIcon
' '
@ -63,9 +67,9 @@ Partial Class frmMain
'StatusStrip1 'StatusStrip1
' '
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tslblUser}) 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.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.TabIndex = 3
Me.StatusStrip1.Text = "StatusStrip1" Me.StatusStrip1.Text = "StatusStrip1"
' '
@ -75,6 +79,23 @@ Partial Class frmMain
Me.tslblUser.Name = "tslblUser" Me.tslblUser.Name = "tslblUser"
Me.tslblUser.Size = New System.Drawing.Size(16, 17) 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 'btnAdminConfig
' '
Me.btnAdminConfig.Image = CType(resources.GetObject("btnAdminConfig.Image"), System.Drawing.Image) 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.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnUserConfig.UseVisualStyleBackColor = True 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 'frmMain
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 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.btnAdminConfig)
Me.Controls.Add(Me.StatusStrip1) Me.Controls.Add(Me.StatusStrip1)
Me.Controls.Add(Me.btnUserConfig) Me.Controls.Add(Me.btnUserConfig)
@ -123,17 +153,21 @@ Partial Class frmMain
Me.cmstrpNotifyIcon.ResumeLayout(False) Me.cmstrpNotifyIcon.ResumeLayout(False)
Me.StatusStrip1.ResumeLayout(False) Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout() Me.StatusStrip1.PerformLayout()
Me.ContextMenuStripForm.ResumeLayout(False)
Me.ResumeLayout(False) Me.ResumeLayout(False)
Me.PerformLayout() Me.PerformLayout()
End Sub End Sub
Friend WithEvents btnUserConfig As System.Windows.Forms.Button 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 cmstrpNotifyIcon As System.Windows.Forms.ContextMenuStrip
Friend WithEvents tsmiChangeState As System.Windows.Forms.ToolStripMenuItem Friend WithEvents tsmiChangeState As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip
Friend WithEvents tslblUser As System.Windows.Forms.ToolStripStatusLabel Friend WithEvents tslblUser As System.Windows.Forms.ToolStripStatusLabel
Friend WithEvents btnAdminConfig As System.Windows.Forms.Button Friend WithEvents btnAdminConfig As System.Windows.Forms.Button
Friend WithEvents TimerClose As System.Windows.Forms.Timer 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 End Class

View File

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

View File

@ -1,6 +1,8 @@
Imports System.Threading Imports System.Threading
Imports DD_LIB_Standards Imports DD_LIB_Standards
Public Class frmMain Public Class frmMain
Dim WithEvents Hotkey As New clsHotkey(Me)
Private PID As Integer Private PID As Integer
Private WithEvents _Watcher As ClipboardWatcher = ClipboardWatcher.Singleton Private WithEvents _Watcher As ClipboardWatcher = ClipboardWatcher.Singleton
Private Sub frmClipboardWatch_Disposed(ByVal sender As Object, _ Private Sub frmClipboardWatch_Disposed(ByVal sender As Object, _
@ -11,7 +13,11 @@ Public Class frmMain
Private Sub _Watcher_Changed(ByVal sender As Object, _ Private Sub _Watcher_Changed(ByVal sender As Object, _
ByVal e As EventArgs) Handles _Watcher.Changed 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 Data As IDataObject = Clipboard.GetDataObject
' Dim RelevantWindow = clsWINDOWSApi.IsRelevantWindow("jonathan") ' Dim RelevantWindow = clsWINDOWSApi.IsRelevantWindow("jonathan")
@ -23,28 +29,35 @@ Public Class frmMain
'End With 'End With
Dim found As Boolean = False Dim found As Boolean = False
CLIPBOARD_TEXT = Clipboard.GetText 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 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 If PROC_Name.ToUpper = row.Item("PROC_NAME").ToString.ToUpper Then
Dim regex_expression = row.Item("REGEX_EXPRESSION") Dim regex_expression = row.Item("REGEX_EXPRESSION")
Dim regex As New System.Text.RegularExpressions.Regex(regex_expression) Dim regex As New System.Text.RegularExpressions.Regex(regex_expression)
Dim match As System.Text.RegularExpressions.Match = regex.Match(CLIPBOARD_TEXT) Dim match As System.Text.RegularExpressions.Match = regex.Match(CLIPBOARD_TEXT)
If match.Success Then 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 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
End If End If
Next 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 End Sub
Public Sub New() Public Sub New()
@ -71,7 +84,7 @@ Public Class frmMain
End Sub End Sub
Private Sub frmMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing 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 If ERROR_INIT = "INVALID USER" Then
Exit Sub Exit Sub
End If End If
@ -85,6 +98,11 @@ Public Class frmMain
Catch ex As Exception Catch ex As Exception
End Try
Try
Hotkey.RemoveHotKey(354522017)
Catch ex As Exception
End Try End Try
'TempDateien löschen 'TempDateien löschen
Try Try
@ -95,23 +113,31 @@ Public Class frmMain
End Try End Try
If clsLogger.LOGG_MSG <> String.Empty Then If clsLogger.LOGG_MSG <> String.Empty Then
ClassLogger.Add(clsLogger.LOGG_MSG, False) clsLogger.Add(clsLogger.LOGG_MSG, False)
End If End If
End Sub End Sub
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
ClassWindowLocation.LoadFormLocationSize(Me) ClassWindowLocation.LoadFormLocationSize(Me)
If clsDatabase.DB_DEFAULT_INITIALIZED = True Then If clsDatabase.DB_DEFAULT_INITIALIZED = True Then
Me.NotifyIcon1.Visible = True Me.NotifyIconMain.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) clsHotkey.Refresh_Profile_Links()
DT_USER_PROFILES = clsDatabase.Return_Datatable(sql) Hotkey.AddHotKey(Keys.T, clsHotkey.MODKEY.MOD_CONTROL, 354522017)
If DT_USER_PROFILES.Rows.Count = 0 Then
MsgBox("Es wurden noch keine Profile für diesen User hinterlegt!", MsgBoxStyle.Exclamation)
End If
End If End If
tslblUser.Text = USER_USERNAME tslblUser.Text = USER_USERNAME
End Sub 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 Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
If ERROR_INIT <> "INVALID USER" And LICENSE_COUNT > 0 Then If ERROR_INIT <> "INVALID USER" And LICENSE_COUNT > 0 Then
If DT_USER_PROFILES.Rows.Count >= 1 Then If DT_USER_PROFILES.Rows.Count >= 1 Then
@ -130,14 +156,14 @@ Public Class frmMain
End If End If
End Sub 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 If Me.Visible = False Then
Me.BringToFront() Me.BringToFront()
Me.Visible = True Me.Visible = True
TimerClose.Start() TimerClose.Start()
Else Else
Me.Hide() Me.Hide()
NotifyIcon1.Visible = True NotifyIconMain.Visible = True
End If End If
End Sub End Sub
@ -153,11 +179,13 @@ Public Class frmMain
tsmiChangeState.Image = My.Resources.control_start_blue tsmiChangeState.Image = My.Resources.control_start_blue
tsmiChangeState.Text = "Überwachung Clipboard starten" tsmiChangeState.Text = "Überwachung Clipboard starten"
MONITORING_ACTIVE = False MONITORING_ACTIVE = False
NotifyIconMain.ShowBalloonTip(30000, "Clipboard Watcher", "Clipboard-Watcher wurde inaktiviert!", ToolTipIcon.Info)
Else Else
tsmiChangeState.Image = My.Resources.StatusAnnotations_Stop_16xLG tsmiChangeState.Image = My.Resources.StatusAnnotations_Stop_16xLG
tsmiChangeState.Tag = "stop" tsmiChangeState.Tag = "stop"
tsmiChangeState.Text = "Überwachung Clipboard stoppen" tsmiChangeState.Text = "Überwachung Clipboard stoppen"
MONITORING_ACTIVE = True MONITORING_ACTIVE = True
NotifyIconMain.ShowBalloonTip(30000, "Clipboard Watcher", "Clipboard-Watcher wurde wieder aktiviert!", ToolTipIcon.Info)
End If End If
End Sub End Sub
'Private Sub Timer1_Tick(sender As Object, e As EventArgs) 'Private Sub Timer1_Tick(sender As Object, e As EventArgs)
@ -192,4 +220,8 @@ Public Class frmMain
End If End If
End Sub End Sub
Private Sub MinimierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MinimierenToolStripMenuItem.Click
Me.Hide()
End Sub
End Class End Class

View File

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

View File

@ -61,6 +61,18 @@
<File Id="DDLibStandarts" Name="DD_LIB_Standards.dll" KeyPath="yes" Checksum="yes"/> <File Id="DDLibStandarts" Name="DD_LIB_Standards.dll" KeyPath="yes" Checksum="yes"/>
</Component> </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}"> <Component Id="RegistryKeys" Guid="{72D6927F-8297-4D51-BF4A-813064089A4A}">
<RegistryKey Root="HKCU" Key="Software"> <RegistryKey Root="HKCU" Key="Software">
@ -80,6 +92,7 @@
<ComponentRef Id="MainApplicationExe" /> <ComponentRef Id="MainApplicationExe" />
<ComponentRef Id="MainApplicationExeConfig"/> <ComponentRef Id="MainApplicationExeConfig"/>
<ComponentRef Id="DDLibStandarts"/> <ComponentRef Id="DDLibStandarts"/>
<ComponentRef Id="DevExpressLibs"/>
<ComponentRef Id="RegistryKeys" /> <ComponentRef Id="RegistryKeys" />
</Feature> </Feature>