Windows notepad position and size.
ledlight |
PRO |
04/25/25 07:27:35 PM UTC |
0 ⭐ |
7156 👁️ |
Never ⏰ |
[console, Visual Studio, notepad, windows 10]
Imports System.Runtime.InteropServices
Module Module1
<DllImport("user32.dll")>
Public Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
<DllImport("user32.dll")>
Public Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr,
ByVal X As Integer, ByVal Y As Integer,
ByVal cx As Integer, ByVal cy As Integer,
ByVal uFlags As UInteger) As Boolean
End Function
Sub Main()
' AOT ohne JIT Prüfung
If Type.GetType("System.Runtime.JitInfo") Is Nothing Then
Console.WriteLine("Läuft ohne JIT.")
Else
Console.WriteLine("JIT wird verwendet.")
End If
' Notepad starten
Dim process As New Process()
process.StartInfo.FileName = "notepad.exe"
process.Start()
Threading.Thread.Sleep(2000) ' Wartezeit für vollständiges Laden
' Fenster-Handle abrufen
Dim hWnd As IntPtr = FindWindow("Notepad", Nothing)
If hWnd = IntPtr.Zero Then
Console.WriteLine("Notepad-Fenster nicht gefunden.")
Return
End If
' Fenster auf Position (X=200, Y=200) setzen mit Größe 800x600
SetWindowPos(hWnd, IntPtr.Zero, 917, 200, 913, 600, 0)
Console.WriteLine("Notepad-Fenster wurde erfolgreich verschoben.")
End Sub
End Module
Comments
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎