diff --git a/app/DD_PM_WINDREAM/ClassParamRefresh.vb b/app/DD_PM_WINDREAM/ClassParamRefresh.vb index d46e1dc..0f778b4 100644 --- a/app/DD_PM_WINDREAM/ClassParamRefresh.vb +++ b/app/DD_PM_WINDREAM/ClassParamRefresh.vb @@ -129,11 +129,20 @@ TL_ICON = False End Try ElseIf oMode.StartsWith("PM.START_CW") Then - Dim oCaption = oMode.Replace("PM.START_CW=", "") + Dim oAfterReplace = oMode.Replace("PM.START_CW=", "") Try START_CW = True - START_CW_CAPTION = oCaption + Dim oSplit As String() = oAfterReplace.Split("~") + START_CW_CAPTION = oSplit(0) + Try + START_CW_LOC_VARIANT = oSplit(1) + Catch ex As Exception + START_CW_LOC_VARIANT = "-1" + LOGGER.Warn($"Could not read START_CW_LOCVARIANT : {ex.Message}") + End Try + Catch ex As Exception + LOGGER.Warn($"Could not read START_CW Param: {ex.Message}") START_CW = False End Try Else diff --git a/app/DD_PM_WINDREAM/ModuleRuntimeVariables.vb b/app/DD_PM_WINDREAM/ModuleRuntimeVariables.vb index ced1769..52d4d67 100644 --- a/app/DD_PM_WINDREAM/ModuleRuntimeVariables.vb +++ b/app/DD_PM_WINDREAM/ModuleRuntimeVariables.vb @@ -83,6 +83,7 @@ Module ModuleRuntimeVariables Public START_CW As Boolean = False Public START_CW_CAPTION As String + Public START_CW_LOC_VARIANT As String = 0 Public LICENSE_COUNT As Integer = 0 Public LICENSE_EXPIRED As Boolean = False diff --git a/app/DD_PM_WINDREAM/frmMain.vb b/app/DD_PM_WINDREAM/frmMain.vb index 3a67bcf..e7a443e 100644 --- a/app/DD_PM_WINDREAM/frmMain.vb +++ b/app/DD_PM_WINDREAM/frmMain.vb @@ -246,9 +246,25 @@ Public Class frmMain End Try If START_CW = True Then - bbtniCW.Caption = START_CW_CAPTION - bbtniCW.Visibility = DevExpress.XtraBars.BarItemVisibility.Always - RibbonPageGroup4.Visible = True + Dim oPath + Select Case START_CW_LOC_VARIANT + Case "-1" + oPath = Directory.GetParent(Application.StartupPath).ToString + Case "0" + oPath = Application.StartupPath.ToString + End Select + + oPath &= "\ClipboardWatcher\DD_Clipboard_Watcher.exe" + If File.Exists(oPath) Then + bbtniCW.Caption = START_CW_CAPTION + bbtniCW.Tag = oPath + bbtniCW.Visibility = DevExpress.XtraBars.BarItemVisibility.Always + RibbonPageGroup4.Visible = True + Else + LOGGER.Warn($"Error in CW-Button init: Could not find CW.Exe {oPath}") + End If + + End If End If @@ -2569,16 +2585,14 @@ Public Class frmMain Private Sub bbtniCW_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniCW.ItemClick Try - Dim oIndex = Application.StartupPath.ToString.LastIndexOf("\") - Dim oParentPath = Directory.GetParent(Application.StartupPath) '.ToString.Substring(0, oIndex) - Dim oPath = oParentPath.ToString & "\ClipboardWatcher\DD_Clipboard_Watcher.exe" - If File.Exists(oPath) Then + + If File.Exists(bbtniCW.Tag) Then Dim MyProcess As New Process() - MyProcess.StartInfo.FileName = oPath + MyProcess.StartInfo.FileName = bbtniCW.Tag MyProcess.Start() Else - LOGGER.Warn($"Clipboardwatcher-Exe not found [{oPath}]") - MsgBox("Global Hook/Clipboard Watcher could not be started!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE) + LOGGER.Warn($"Clipboardwatcher-Exe not found [{bbtniCW.Tag}]") + MsgBox("Clipboard Watcher could not be started!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE) End If Catch ex As Exception