title image


Smiley Re: Sendkeys an ein bestimmtes Fenster
Mit SendMessage() oder PostMessage() z.B. Folgender Code schickt ein "2" zur Text1 TextBox:



Option Explicit



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



Const WM_KEYDOWN = &H100

Const WM_KEYUP = &H101

Const WM_CHAR = &H102



Public Sub SendKey(hWnd As Long)

SendMessage hWnd, WM_KEYDOWN, &H62, 0 '&H500001

SendMessage hWnd, WM_CHAR, &H32, 0 ' &H500001

SendMessage hWnd, WM_KEYUP, &H62, 0 '&HC0500001

End Sub





Private Sub Command1_Click()

Call SendKey(Text1.hWnd)

End Sub





Nochmal zum kopieren:



Option Explicit



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



Const WM_KEYDOWN = &H100

Const WM_KEYUP = &H101

Const WM_CHAR = &H102



Public Sub SendKey(hWnd As Long)

SendMessage hWnd, WM_KEYDOWN, &H62, 0 '&H500001

SendMessage hWnd, WM_CHAR, &H32, 0 ' &H500001

SendMessage hWnd, WM_KEYUP, &H62, 0 '&HC0500001

End Sub





Private Sub Command1_Click()

Call SendKey(Text1.hWnd)

End Sub


Moderation is OK, but not to excess...



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: