mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Focus fixes for PuTTYNG.
This commit is contained in:
@@ -136,6 +136,9 @@ Namespace App
|
||||
Public Const MF_BYPOSITION As Integer = &H400
|
||||
Public Const MF_POPUP As Integer = &H10
|
||||
|
||||
Public Const WM_ENTERSIZEMOVE As Integer = &H231
|
||||
Public Const WM_EXITSIZEMOVE As Integer = &H232
|
||||
|
||||
Public Const WM_GETTEXT As Integer = &HD
|
||||
Public Const WM_ACTIVATEAPP As Integer = &H1C
|
||||
Public Const WM_WINDOWPOSCHANGED As Integer = &H47
|
||||
|
||||
@@ -155,6 +155,8 @@ Namespace Connection
|
||||
|
||||
PuttyHandle = FindWindowEx(Me.InterfaceControl.Handle, 0, vbNullString, vbNullString)
|
||||
|
||||
'SetParent(PuttyHandle, InterfaceControl.Handle)
|
||||
|
||||
mC.AddMessage(Messages.MessageClass.InformationMsg, My.Resources.strPuttyStuff, True)
|
||||
|
||||
mC.AddMessage(Messages.MessageClass.InformationMsg, String.Format(My.Resources.strPuttyHandle, PuttyHandle.ToString), True)
|
||||
@@ -173,7 +175,7 @@ Namespace Connection
|
||||
|
||||
Public Overrides Sub Focus()
|
||||
Try
|
||||
SetFocus(PuttyHandle)
|
||||
SetForegroundWindow(PuttyHandle)
|
||||
Catch ex As Exception
|
||||
mC.AddMessage(Messages.MessageClass.ErrorMsg, My.Resources.strPuttyFocusFailed & vbNewLine & ex.Message, True)
|
||||
End Try
|
||||
|
||||
@@ -706,9 +706,7 @@ Public Class frmMain
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private bWmGetTextFlag As Boolean = False
|
||||
Private bWmWindowPosChangedFlag As Boolean = False
|
||||
|
||||
Private _inSizeMove As Boolean = False
|
||||
Protected Overloads Overrides Sub WndProc(ByRef m As Message)
|
||||
Try
|
||||
#If Config = "Debug" Then
|
||||
@@ -716,19 +714,15 @@ Public Class frmMain
|
||||
#End If
|
||||
|
||||
Select Case m.Msg
|
||||
Case WM_GETTEXT
|
||||
bWmGetTextFlag = True
|
||||
Case WM_ENTERSIZEMOVE
|
||||
_inSizeMove = True
|
||||
Case WM_EXITSIZEMOVE
|
||||
_inSizeMove = False
|
||||
ActivateConnection()
|
||||
Case WM_WINDOWPOSCHANGED
|
||||
If bWmGetTextFlag Then
|
||||
ActivateConnection()
|
||||
End If
|
||||
|
||||
bWmGetTextFlag = False
|
||||
bWmWindowPosChangedFlag = True
|
||||
If Not _inSizeMove Then ActivateConnection()
|
||||
Case WM_ACTIVATEAPP
|
||||
If bWmWindowPosChangedFlag Then
|
||||
ActivateConnection()
|
||||
End If
|
||||
If Not _inSizeMove Then ActivateConnection()
|
||||
Case WM_SYSCOMMAND
|
||||
For i As Integer = 0 To SysMenSubItems.Length - 1
|
||||
If SysMenSubItems(i) = m.WParam Then
|
||||
@@ -743,9 +737,6 @@ Public Class frmMain
|
||||
'Send to the next window
|
||||
SendMessage(fpChainedWindowHandle, m.Msg, m.LParam, m.WParam)
|
||||
fpChainedWindowHandle = m.LParam
|
||||
Case Else
|
||||
bWmGetTextFlag = False
|
||||
bWmWindowPosChangedFlag = False
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
|
||||
Reference in New Issue
Block a user