SendKeys problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hiwhatsup
    New Member
    • Feb 2006
    • 1

    SendKeys problem

    hello, is it possible to use SendKeys in c# to send a listbox item from the form to a textbox in another application? Im trying to use SendKeys because after weeks of trying to use API with my framework 2.0, Im fully convinced that it is either impossible to do or know one knows how, so i thought maybe SendKeys would be easier. thanks in advance!
  • nirajjha
    New Member
    • Jul 2007
    • 14

    #2
    try this just an example that will clear your concepts

    Dim hWndApp As LongDim sApplication As StringDim hWndChild As LongDim sBuffer As String * 32Dim nSize As Long hWndApp = FindWindow("Thu nderRT6FormDC", "Password")hWnd Button = FindWindowEx(hW ndApp, 0, "ThunderRT6Comm andButton", "&Ok")hWndC hild = FindWindowEx(hW ndApp, 0, "ThunderRT6Text Box", "") If hw ThenhWndChild = GetWindow(hWndA pp, GW_CHILD) Do While hWndChild <> 0 'get the Class Name of the window nSize = GetClassName(hW ndChild, sBuffer, 32) 'MsgBox hWndChild 'if nSize > 0, it contains the length 'of the class name retrieved If nSize Then 'if the class name is "Edit", 'set some text and exit If Left$(sBuffer, nSize) = "ThunderRT6Text Box" Then Call SendMessage(hWn dChild, WM_SETTEXT, 0&, ByVal passcode) hWndChild = GetWindow(hWndC hild, GW_HWNDNEXT) Call SendMessage(hWn dChild, WM_SETTEXT, 0&, ByVal login) Call SendMessage(hWn dButton, BM_CLICK, 0, 0) Exit Sub End If End If 'not found, so get the next hwnd hWndChild = GetWindow(hWndC hild, GW_HWNDNEXT) Loop End If

    Comment

    Working...