this code sends 2 Tabs when it should only send one, shouldn't it?
VB Code:
  1. Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" ( _
  2.     ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  3.  
  4. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _
  5.     ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
  6.  
  7. Private Const WM_KEYDOWN = &H100
  8. Private Const WM_KEYUP = &H101
  9.  
  10. Private Sub Command1_Click()
  11.     Dim lhWnd As Long
  12.    
  13.     lhWnd = FindWindowEx(FindWindowEx(0&, 0&, "notepad", vbNullString), 0&, "Edit", vbNullString)
  14.     PostMessage lhWnd, WM_KEYDOWN, vbKeyTab, 1&
  15.     PostMessage lhWnd, WM_KEYUP, vbKeyTab, 1&
  16. End Sub
both WM_KEYDOWN and WM_KEYUP are causing a tab to be fired.

Should I be expecting this? I'm tired and confused...