Hallo,
ich habe einen Fenster-Handle, und möchte nun an dieses Fenster ein paar Tastenkombinationen schicken - um genau zu sein: Tabulator, Leertaste, Pfeiltasten.
Müsste eigentlich mit der API-Funktion SendMessage() gehen. Diese Funktion ist mir allerdings noch immer ein Rätsel … wer kann mir da weiterhelfen.
Die VB-Funktion SendKeys() möchte ich NICHT verwenden!!!
hwnd ;dürfte klar sein
msg ;jedes fenster kann bestimmte definierte nachrichten empfangen zb. WM_GETTEXT
API:
An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller.
WM_GETTEXT
wParam = (WPARAM) cchTextMax; // number of characters to copy
lParam = (LPARAM) lpszText; // address of buffer for text
Parameters
cchTextMax
Value of wParam. Specifies the maximum number of characters to be copied, including the terminating null character.
lpszText
Value of lParam. Pointer to the buffer that is to receive the text.
Return Values
The return value is the number of characters copied.
Function
lR = SendMessage(m_hwnd, WM_GETTEXT, (lR + 1), ByVal sText)
vorsicht -> lParam As Any [als byref] und datentyp [als unbestimmt definiert], erwartet bzw. gibt aber auch bei bestimmten msg nur ein zeiger zurück !!!
Private Declare Function SendMessage Lib „user32“ Alias „SendMessageA“ (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
kommt darauf an was und an wem du nachrichten senden willst
msg=[userdefiniert] ist auch möglich wenn es die andere seite (hwnd) empfangen kann.
volker
[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]