Einzelnen Beitrag anzeigen
Ungelesen 05.10.10, 18:25   #7
.ShoXx!
 
Benutzerbild von .ShoXx!
 
Registriert seit: Dec 2009
Beiträge: 792
Bedankt: 49
.ShoXx! ist noch neu hier! | 8 Respekt Punkte
Standard

Code:
Option Strict On
Public Class Form1

    Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
    Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWndParent As Integer, ByVal hWndChildAfter As Integer, ByVal lpszClass As String, ByVal lpszWindow As String) As Integer
    Private Declare Function SendMessageByString Lib "user32.dll" Alias "SendMessageA" (ByVal handle As IntPtr, ByVal uMsg As Int32, ByVal wParam As IntPtr, ByVal lParam As String) As Integer

    Const WM_SETTEXT As Integer = &HC
    Const WM_KEYDOWN As Integer = &H100
    Const WM_KEYUP As Integer = &H101

    Private hwnd As IntPtr
    Private f As IntPtr

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text <> "" Then
            If Not ListView1.Items.Count = 0 Then
                For i As Integer = 0 To ListView1.Items.Count - 1
                    hwnd = System.Diagnostics.Process.GetProcessesByName("Skype")(0).MainWindowHandle
                    f = CType(FindWindowEx(CInt(hwnd), 0, "TConversationForm.UnicodeClass", ListView1.Items(i).Text), IntPtr)
                    f = CType(FindWindowEx(CInt(f), 0, "TChatEntryControl", vbNullString), IntPtr)
                    f = CType(FindWindowEx(CInt(f), 0, "TChatRichEdit.UnicodeClass", vbNullString), IntPtr)

                    SendMessageByString(f, WM_SETTEXT, CType(0, IntPtr), TextBox1.Text)
                    SendMessageByString(f, WM_KEYDOWN, CType(13, IntPtr), CStr(1))
                    SendMessageByString(f, WM_KEYUP, CType(13, IntPtr), CStr(1))
                Next
            Else
                MessageBox.Show("Keine Kontakte vorhanden!", "Kontakte", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End If
        Else
            MessageBox.Show("Bitte eine Nachricht eingeben!", "Nachricht", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox2.Text <> "" Then
            ListView1.Items.Add(TextBox2.Text)
            TextBox2.Clear()
        Else
            MessageBox.Show("Bitte einen Kontaktnamen eingeben!", "Kontaktname", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ListView1.FocusedItem.Remove()
    End Sub

End Class
__________________
To succeed you have to stop being ordinary and be legen - wait for it - dary.
.ShoXx! ist offline   Mit Zitat antworten