-
23.05.2011, 22:41 #1
[VB - Source] Knuddels Titelfenster ändern (WinApi)
... sniper coding ...
- Bots - Opensource - Sourcecodes -
Hallo.
Hier ist ein SourceCode, wie ihr ganz einfach den Titeltext von Knuddels (z.B. Channel: K-Script, Nick: Sniper) verändern könnt.
EndScreen:
Code:
PHP-Code:Imports System
Imports System.Text
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="SendMessageA")> _
Public Shared Function SendMessages(ByVal hWnd As Integer, ByVal Msg As UInteger, ByVal wParam As Integer, ByVal lParam As String) As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function FindWindowEx(ByVal hwndParent As IntPtr, ByVal hwndChildAfter As IntPtr, ByVal lpszClass As String, ByVal lpszWindow As String) As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Public Shared Function FindWindowEx(ByVal parentHandle As IntPtr, ByVal childAfter As IntPtr, ByVal className As String, ByVal windowTitle As IntPtr) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="SendMessageA")> _
Public Shared Function SendMessage(ByVal hWnd As Integer, ByVal wMsg As UInteger, ByVal wParam As UInteger, ByVal lParam As Integer) As IntPtr
End Function
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)
Private Sub RefreshWindowList()
newwindowlist = New List(Of String)
EnumWindows(AddressOf EnumWinProc, CInt(True))
End Sub
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
Public Const WM_SETTEXT As UInteger = 12
Public Const cap As Integer = 1048576
Private hWnd As IntPtr
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each item As String In CheckedListBox1.CheckedItems
Dim titelfensterüberschrift As String = "TEXT - http://sniper.x9.eu/"
hWnd = FindWindow("SunAwtFrame", item)
SendMessages(hWnd.ToInt32(), WM_SETTEXT, cap, titelfensterüberschrift)
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RefreshWindowList()
CheckedListBox1.Items.Clear()
For Each item As String In newwindowlist
If item.StartsWith("Channel") Then
CheckedListBox1.Items.Add(item)
End If
Next
End Sub
End Class
Grüße.
Ähnliche Themen
-
[Source] KFramework - Knuddels Controls
Von patlux im Forum SourcecodeAntworten: 3Letzter Beitrag: 20.07.2013, 22:14 -
Profilbild ändern
Von CAKEBUILDER im Forum SupportAntworten: 1Letzter Beitrag: 09.02.2012, 20:19 -
[Open Source] Knuddels Live Client v1.0.90aeh
Von Nightking im Forum SourcecodeAntworten: 0Letzter Beitrag: 18.05.2011, 19:33
Diese Seite nutzt Cookies, um das Nutzererlebnis zu verbessern. Klicken Sie hier, um das Cookie-Tracking zu deaktivieren.