Hallo,
mir fehlt ein Lösungsansatz wie ich ermitteln kann auf welchem Monitor sich ein fremder Prozess befindet.
Das habe ich bereits als Ansatz:
API
Und hier die Funktion:
mir fehlt ein Lösungsansatz wie ich ermitteln kann auf welchem Monitor sich ein fremder Prozess befindet.
Das habe ich bereits als Ansatz:
API
Und hier die Funktion:
VB.NET-Quellcode
- Public Shared Sub MoveWindowToMonitor(ByVal monitor As Integer, ByVal hwnd As IntPtr)
- Try
- Dim windowRec As Desktop.Win32.RECT
- GetWindowRect(hwnd, windowRec)
- Dim rec As New Rectangle
- rec.X = windowRec.Left
- rec.Y = windowRec.Top
- rec.Width = windowRec.Right - windowRec.Left + 1
- rec.Height = windowRec.Bottom - windowRec.Top + 1
- 'Hier ist das Problem
- For Each scr In Screen.AllScreens
- If rec.Location.X > scr.WorkingArea.X Then
- MsgBox("Fenster befindet sich auf " & scr.DeviceName)
- End If
- Next
- 'Desktop.Win32.SetWindowPos(hwnd, New IntPtr(0), _
- ' Screen.AllScreens(monitor).WorkingArea.Left, _
- ' Screen.AllScreens(monitor).WorkingArea.Top, _
- ' (rec.Size.Width + 16), _
- ' (rec.Size.Height + 38), 64)
- Catch ex As Exception
- MsgBox(ex.Message, 16)
- End Try
- End Sub