Wondering if anyone here has a general knowledge of the Windows API and .NET. I'm currently attempting to hack my way through finding a hidden Window, and being able to read the lines from a textbox, and change the value of/submit with enter an editbox beneath it.
I'm a complete idiot when it comes to any "real" programming language, but here's what I've managed so far:
Right now it just prints ET Console to the window, which is the proper title of the window I'm trying to mess with. Any help would be greatly appreciated!
I'm a complete idiot when it comes to any "real" programming language, but here's what I've managed so far:
- Code:
Module Module1
Private Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Private Declare Auto Function GetWindowText Lib "user32" (ByVal hwnd As IntPtr, ByVal lpString As String, ByVal cch As Integer) As Integer
Private Declare Auto Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Function GetETConsole() As String
Dim Consolehwnd As IntPtr = FindWindow(vbNullString, "ET Console")
If Consolehwnd.Equals(IntPtr.Zero) Then Return "Not running"
Dim lpText As New String(Chr(0), 100)
Dim intLength As Integer = GetWindowText(Consolehwnd, lpText, lpText.Length)
If (intLength <= 0) OrElse (intLength > lpText.Length) Then Return "Unknown"
Dim strTitle As String = lpText.Substring(0, intLength)
Return strTitle
End Function
Public Sub Main()
Console.WriteLine(GetETConsole())
Console.ReadLine()
End Sub
End Module
Right now it just prints ET Console to the window, which is the proper title of the window I'm trying to mess with. Any help would be greatly appreciated!