I'm a complete idiot when it comes to any "real" programming language, but here's what I've managed so far:
- Code: Select all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25Module 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 Module25 lines; 0 keywds; 4 nums; 55 ops; 6 strs; 0 coms Syntactic Coloring v0.4 - Dan East
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!
