Hallo,
Ich würde ganz gerne das Programm fdKlinika mit einen zusätzlichen vb.net Programm zwecks Automatisierung (Macro ähnlich) über SendMessage von meinen Visual Basic Programm aus Steuern. Jetzt ist für mich natürlich die Frage. Kennt jemand ein gutes Tutorial für SendMessage.
Wichtig ist neben Grundlegenden ein ListView auslesen und beschreiben zu können. Und eine Textbox / RichTextbox diese aber in ein Groupview versteckt / eingebettet ist.
Ich habe schon etwas Gegoogelt und bin scheinbar nicht so weit gekommen, hier ist mein Coode:
Vielen Danck an alle schonmal in vorraus
LG, Herbrich
Ich würde ganz gerne das Programm fdKlinika mit einen zusätzlichen vb.net Programm zwecks Automatisierung (Macro ähnlich) über SendMessage von meinen Visual Basic Programm aus Steuern. Jetzt ist für mich natürlich die Frage. Kennt jemand ein gutes Tutorial für SendMessage.
Wichtig ist neben Grundlegenden ein ListView auslesen und beschreiben zu können. Und eine Textbox / RichTextbox diese aber in ein Groupview versteckt / eingebettet ist.
Ich habe schon etwas Gegoogelt und bin scheinbar nicht so weit gekommen, hier ist mein Coode:
VB.NET-Quellcode
-
- Imports System.Runtime.InteropServices
- Imports System.Text
- Public Class fdConnector
- Private Declare Function SendMessageByString Lib "user32.dll" Alias "SendMessageA" _
- (ByVal hWnd As IntPtr, _
- ByVal uMsg As Integer, _
- ByVal wParam As Integer, _
- ByVal lParam As StringBuilder) As Integer
- Private Declare Function SendMessageByInt Lib "user32.dll" Alias "SendMessageA" _
- (ByVal hWnd As IntPtr, _
- ByVal uMsg As Integer, _
- ByVal wParam As Integer, _
- ByVal lParam As Integer) As Integer
- Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" _
- (ByVal handle As IntPtr, ByVal uMsg As Integer, _
- ByVal wParam As IntPtr, ByVal lParam As String) As IntPtr
- Const WM_SETTEXT As Integer = &HC
- <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
- Private Shared Function FindWindow( _
- ByVal lpClassName As String, _
- ByVal lpWindowTitle As String) As IntPtr
- End Function
- <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
- Private Shared Function FindWindowEx(ByVal parentHandle As IntPtr, _
- ByVal childAfter As IntPtr, _
- ByVal lpClassName As String, _
- ByVal lpWindowTitle As String) As IntPtr
- End Function
- Protected KliDDE As IntPtr = fdConnector.FindWindow("MSCTFIME UI", "KliDDE")
- Protected KliDDE_LogServer = fdConnector.FindWindowEx(Me.KliDDE, IntPtr.Zero, "Button", Nothing)
- Protected KliDDE_LogInterface = fdConnector.FindWindowEx(Me.KliDDE_LogServer, IntPtr.Zero, "RICHEDIT", "Protokoll")
- Const WM_GETTEXT As Integer = &HD
- Const WM_GETTEXTLENGTH As Integer = &HE
- Public Function GetLogText() As String
- If (Not Me.KliDDE.Equals(IntPtr.Zero)) Then
- Dim length As Integer = SendMessageByInt(Me.KliDDE, WM_GETTEXTLENGTH, 0, 0)
- If length > 0 Then
- Dim SB As New StringBuilder(length)
- Dim Result As Int32 = SendMessageByString(Me.KliDDE, WM_GETTEXT, length + 1, SB)
- If Result <> 0 Then
- Return SB.ToString()
- Else
- Return String.Empty
- End If
- Else
- Return "Kein Text vorhanden"
- End If
- Else
- Return "Handle nicht gefunden"
- End If
- End Function
- End Class
Vielen Danck an alle schonmal in vorraus
LG, Herbrich