I'm using vb6. How do I use sendmessage to send text to the microsoft internet controls component that's in my main form. I need to send text to a textbox that's in a webpage in the browser. Everything works flawlessly with sendkeys, however I really want to free up my computer to do other things. The webpage is also in XML.
Right now I can set the text of a textbox.
To prevent garbage text i used a modified sendmessage (change ByVal lParam As Any to ByVal lParam As String)
Code:Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As LongThe above code worksCode:Call SendMessageByString(Frmmain.Text2.hwnd, WM_SETTEXT, 0&, "Hello")
What I am trying to do is
The above code returns both an automation error and an unknown error in a single msgbox. I've tried wm_keydown / wm_keyup and it doesn't work for the textbox (I think I'm doing something wrong). Remember that the webpage is in XML. I think the problem is that a specific object like a textbox in the webpage needs to be pointed out, otherwise it sends text to the browser component which does nothing. Just like trying to send text to a picturebox does nothing. I know there's a command out there where you can enter in text to a certain object or element in the webpage but I forgot how to do it.Code:Call SendMessageByString(Frmmain.browser.hwnd, WM_SETTEXT, 0&, "Hello")
orCode:Frmmain.Browser.Document.All("Id of html element").SetAttribute("Value", "new value")
The above code seems to be in vb.net, is browser.document.all going to solve my problem?Code:frmmain.Browser.Document.GetElementById("username").SetAttribute("Value", frmmain.txtuser.Text)




Reply With Quote