| |
![zurück](../images/b_zurueck.gif)
VB & Windows APIFindWindow + SendMessage | | ![](../images/trans.gif) | Autor: basdo x3 | Datum: 25.04.08 19:37 |
| n' Abend
Mein Code:
Public Class Form1
Public Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As _
EnumWindowsProc, ByVal lParam As Int32) As Int32
Public Declare Function IsWindowVisible Lib "user32.dll" (ByVal hwnd As _
IntPtr) As Boolean
Public Delegate Function EnumWindowsProc(ByVal hwnd As IntPtr, ByVal lParam _
As Int32) As Boolean
Public Declare Function GetWindowText Lib "user32.dll" Alias _
"GetWindowTextA" (ByVal hwnd As IntPtr, ByVal lpString As String, ByVal cch _
As Int32) As Int32
Public Declare Function GetWindowTextLength Lib "user32.dll" Alias _
"GetWindowTextLengthA" (ByVal hwnd As IntPtr) As Int32
Public Declare Function GetWindowLong Lib "user32.dll" Alias _
"GetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Int32) As Int32
Public Declare Function GetParent Lib "user32.dll" (ByVal intptr As IntPtr) _
As IntPtr
Public Const GWL_HWNDPARENT As Int32 = -8
Private newwindowlist As List(Of String)
Declare Function SendMessage Lib "user32.dll" _
Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal Msg As Long)
Private Function EnumWinProc(ByVal hwnd As IntPtr, ByVal lParam As Int32) _
As Boolean
If IsWindowVisible(hwnd) Then
If GetParent(hwnd) = IntPtr.Zero Then
If GetWindowLong(hwnd, GWL_HWNDPARENT) = 0 Then
Dim str As String = String.Empty.PadLeft( _
GetWindowTextLength(hwnd) + 1)
GetWindowText(hwnd, str, str.Length)
If Not String.IsNullOrEmpty(str.Substring(0, str.Length - _
1)) Then newwindowlist.Add(str.Substring(0, str.Length - _
1))
End If
End If
End If
EnumWinProc = True
End Function
Private Sub RefreshWindowList()
newwindowlist = New List(Of String)
EnumWindows(AddressOf EnumWinProc, CInt(True))
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
RefreshWindowList()
For Each item As String In newwindowlist
If item.EndsWith(" - Chat") Then 'nach dem Channel Fenster suchen
ListBox1.Items.Add(item)
End If
Next
End Sub
Private Sub Button1_Click() 'Liste erneuern
RefreshWindowList()
For Each item As String In newwindowlist
If item.EndsWith(" - Chat") Then 'nach dem Channel Fenster suchen
ListBox1.Items.Add(item)
End If
Next
End Sub
End Class Findet schonmal die Fenster mit dem Namen " - Chat" am Ende, ich hab bloß keine Ahnung wie ich etwas in das Ausgewählte Fenster sende? Ich weiß zwar, das ich es mit der SendMessage Funktion machen muss, bin jdeoch jedesmal gescheitert.
Hätte jemand ein Sample/Codeauschnitt?
Mfg
Basdo | ![](../images/trans.gif) |
![](../images/48x48/info.gif) | Sie sind nicht angemeldet! Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.
Einloggen | Neu registrieren |
![nach oben](../images/b_top.gif) ![zurück](../images/b_zurueck.gif) |
|
Neu! sevDTA 3.0 Pro ![sevDTA - für VB/VBA und VB.NET](../images/werbung/sevdta_100x100.jpg)
SEPA mit Kontonummernprüfung
Erstellen von SEPA-Dateien mit integriertem BIC-Verzeichnis und Konto- nummern-Prüfverfahren, so dass ungültige Bankdaten bereits im Vorfeld ermittelt werden können. Weitere InfosTipp des Monats Access-Tools Vol.1 ![Access-Tools CD Vol.1](../images/werbung/apvol1_68x100.gif)
Über 400 MByte Inhalt
Mehr als 250 Access-Beispiele, 25 Add-Ins und ActiveX-Komponenten, 16 VB-Projekt inkl. Source, mehr als 320 Tipps & Tricks für Access und VB
Nur 24,95 EURWeitere Infos
|
|
|
Copyright ©2000-2024 vb@rchiv Dieter Otter Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.
Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel
|
|