MS20072015_1
This commit is contained in:
@@ -59,7 +59,21 @@ Public Class ClassHotkey_Windream
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'Fenster position ermitteln/auslesen
|
||||
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 Structure RECT
|
||||
Dim Left As Integer
|
||||
Dim Top As Integer
|
||||
Dim Right As Integer
|
||||
Dim Bottom As Integer
|
||||
End Structure
|
||||
Private Shared Sub GetWindowClientSize(ByVal hWnd As Long)
|
||||
Dim rc As RECT
|
||||
GetWindowRect(hWnd, rc)
|
||||
'Left = rc.Right - rc.Left
|
||||
'Height = rc.Bottom - rc.Top
|
||||
End Sub
|
||||
Public Shared Function RUN_WD_SEARCH(HK_USR_PROFILE_ID As Integer)
|
||||
Try
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" ...RUN_WD_SEARCH with HK_USR_PROFILE_ID '" & HK_USR_PROFILE_ID & "'", False)
|
||||
@@ -67,7 +81,7 @@ Public Class ClassHotkey_Windream
|
||||
Dim Objecttype As String
|
||||
Dim windowname As String
|
||||
Dim HKPROFILE_ID As Integer
|
||||
|
||||
|
||||
|
||||
Dim _sql = "SELECT WD_SEARCH,HKPROFILE_ID FROM TBHOTKEY_USER_PROFILE WHERE GUID = " & HK_USR_PROFILE_ID
|
||||
DTWD = ClassDatabase.Return_Datatable(_sql)
|
||||
@@ -189,21 +203,57 @@ Public Class ClassHotkey_Windream
|
||||
ClassLogger.Add("TempFile could not be created: " & ex.Message, True)
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unerwarteter Fehler in Write XmlSearch:")
|
||||
End Try
|
||||
|
||||
|
||||
CURRENT_WD_TEMPSEARCH = windream_temp_search
|
||||
Try
|
||||
Dim myhWnd As IntPtr
|
||||
Dim p As New Process()
|
||||
p.StartInfo.FileName = windream_temp_search
|
||||
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal
|
||||
If My.Settings.WDSearch_maximized = True Then
|
||||
p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
|
||||
Else
|
||||
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal
|
||||
End If
|
||||
p.Start()
|
||||
'p.WaitForExit()
|
||||
'p.Close()
|
||||
|
||||
myhWnd = p.MainWindowHandle
|
||||
Threading.Thread.Sleep(1000)
|
||||
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)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Ausführen der windream-Suche:")
|
||||
ClassLogger.Add("Unexpected error while executing search: " & ex.Message, True)
|
||||
Return "Unexpected error while executing search"
|
||||
End Try
|
||||
|
||||
Dim psList() As Process
|
||||
Try
|
||||
psList = Process.GetProcesses()
|
||||
|
||||
For Each p As Process In psList
|
||||
Console.WriteLine(p.Id.ToString() + " " + p.ProcessName)
|
||||
If p.ProcessName.Contains("indream.Find") Then
|
||||
AppActivate(p.Id)
|
||||
If My.Settings.WDSearch_maximized = False Then
|
||||
Dim rctMain As RECT
|
||||
GetWindowRect(p.MainWindowHandle, rctMain)
|
||||
If rctMain.Left = 0 Or rctMain.Right = 0 Then
|
||||
ShowWindow(p.MainWindowHandle, 3) ' SW_MAXIMIZE
|
||||
End If
|
||||
End If
|
||||
' SetForeGroundWindow(p.MainWindowHandle)
|
||||
End If
|
||||
|
||||
Next p
|
||||
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected error while Setting foreground: " & ex.Message, True)
|
||||
End Try
|
||||
Return ""
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected error in Create Search: " & ex.Message, True)
|
||||
@@ -219,4 +269,9 @@ Public Class ClassHotkey_Windream
|
||||
|
||||
|
||||
End Function
|
||||
Private Declare Function ShowWindow Lib "user32" (ByVal handle As IntPtr, ByVal nCmdShow As Integer) As Integer
|
||||
Declare Auto Function SetForeGroundWindow Lib "User32.dll" (ByVal Hwnd As IntPtr) As Integer
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user