From 5b0ba26ecd89e8b6b88b2581ea7c8678a6451c25 Mon Sep 17 00:00:00 2001 From: Andreas Rehm Date: Sun, 20 Feb 2011 12:19:05 +0100 Subject: [PATCH] Code optimization and bugfix #22 --- .../Connection/Connection.Protocol.IntApp.vb | 5 +--- mRemoteV1/Tools/Tools.ExternalApp.vb | 26 ++++++++++++------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/mRemoteV1/Connection/Connection.Protocol.IntApp.vb b/mRemoteV1/Connection/Connection.Protocol.IntApp.vb index db577eb1..885478ef 100644 --- a/mRemoteV1/Connection/Connection.Protocol.IntApp.vb +++ b/mRemoteV1/Connection/Connection.Protocol.IntApp.vb @@ -1,7 +1,5 @@ Imports mRemoteNG.App.Native Imports System.Threading -Imports Microsoft.Win32 -Imports System.Drawing Imports mRemoteNG.App.Runtime Namespace Connection @@ -112,12 +110,11 @@ Namespace Connection IntAppHandle = IntAppProcess.MainWindowHandle - mC.AddMessage(Messages.MessageClass.InformationMsg, My.Resources.strIntAppStuff, True) mC.AddMessage(Messages.MessageClass.InformationMsg, String.Format(My.Resources.strIntAppHandle, IntAppHandle.ToString), True) mC.AddMessage(Messages.MessageClass.InformationMsg, String.Format(My.Resources.strIntAppTitle, IntAppProcess.MainWindowTitle), True) - mC.AddMessage(Messages.MessageClass.InformationMsg, String.Format(My.Resources.strIntAppParentHandle & Me.InterfaceControl.Parent.Handle.ToString), True) + mC.AddMessage(Messages.MessageClass.InformationMsg, String.Format(My.Resources.strIntAppParentHandle, Me.InterfaceControl.Parent.Handle.ToString), True) SetParent(Me.IntAppHandle, Me.InterfaceControl.Parent.Handle) SetWindowLong(Me.IntAppHandle, 0, WS_VISIBLE) diff --git a/mRemoteV1/Tools/Tools.ExternalApp.vb b/mRemoteV1/Tools/Tools.ExternalApp.vb index 6bb9336f..5d49e5ee 100644 --- a/mRemoteV1/Tools/Tools.ExternalApp.vb +++ b/mRemoteV1/Tools/Tools.ExternalApp.vb @@ -103,16 +103,16 @@ Namespace Tools _Arguments = Arguments End Sub - + ' Start external app Public Function Start(Optional ByVal ConnectionInfo As Connection.Info = Nothing) As Process Try - If _TryIntegrate = True Then - StartIntApp(ConnectionInfo) + If _FileName = "" Then + Throw New Exception("No Filename specified!") Return Nothing End If - If _FileName = "" Then - Throw New Exception("No Filename specified!") + If _TryIntegrate = True Then + StartIntApp(ConnectionInfo) Return Nothing End If @@ -139,20 +139,26 @@ Namespace Tools End Try End Function + ' Start external app integrated Public Sub StartIntApp(Optional ByVal ConnectionInfo As Connection.Info = Nothing) Try - If _FileName = "" Then - Throw New Exception("No Filename specified!") - Exit Sub - End If - _ConnectionInfo = ConnectionInfo Dim nCI As New Connection.Info + nCI.Protocol = Connection.Protocol.Protocols.IntApp nCI.ExtApp = Me.DisplayName nCI.Name = Me.DisplayName nCI.Panel = "Int. Apps" + nCI.Hostname = _ConnectionInfo.Hostname + nCI.Port = _ConnectionInfo.Port + nCI.Username = _ConnectionInfo.Username + nCI.Password = _ConnectionInfo.Password + nCI.Domain = _ConnectionInfo.Domain + nCI.Description = _ConnectionInfo.Description + nCI.MacAddress = _ConnectionInfo.MacAddress + nCI.UserField = _ConnectionInfo.UserField + nCI.Description = _ConnectionInfo.Description OpenConnection(nCI) Catch ex As Exception