Author | Message | Time |
---|---|---|
Tontow | I'm useing the webbrowser control. The web page has several textboxes cheackboxes and raido buttons. When the user hits send - Is it possable to detect what the user has entered into those textboxes cheackboxes and raido buttons? The only way that I can think of right now is a key logger, but thats a bad thing to have in a program. | June 17, 2005, 8:21 AM |
OnlyMeat | [quote author=Tontow link=topic=11869.msg116202#msg116202 date=1118996518] When the user hits send - Is it possable to detect what the user has entered into those textboxes cheackboxes and raido buttons? [/quote] The Webbrowser control has a IWebBrowser2 COM interface associated with it. That interface has a Document property, which when loaded with a html page is a pointer to the DOM(document object model) via the HTMLDocument coclass interface. This interface can be used to access elements within the page. For further information refer to this link:- [url]http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/iwebbrowser2/iwebbrowser2.asp[/url] | June 17, 2005, 10:01 AM |
Tontow | Isn't that a c/c++ reference? | June 17, 2005, 6:08 PM |
OnlyMeat | [quote author=Tontow link=topic=11869.msg116224#msg116224 date=1119031700] Isn't that a c/c++ reference? [/quote] It's an COM interface reference for the control. I'm assuming you can access those same properties through the normal IDispatch route as well. | June 17, 2005, 7:33 PM |
Tontow | I'm kind of flying blind with this one......... I found "Handling Events in Visual Basic Applications" - http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/ifaces/iwebbrowser2/iwebbrowser2.asp So I'm guessing that the only way to do it is to write an event handler?? That seems like a bit much to me for grabbing user inputed information. (edit: forgot the t on event) | June 17, 2005, 10:58 PM |
OnlyMeat | [quote author=Tontow link=topic=11869.msg116251#msg116251 date=1119049125] So I'm guessing that the only way to do it is to write an even handler?? That seems like a bit much to me for grabbing user inputed information. [/quote] From your original statement, you said you needed 2 things. (1) To be informed when a user pushes a button on a html page. (2) To then extract a set of data from some kind of input controls. 1. Requires you to be notified of events. An example of this would be :- Firstly setup a button/textbox html element tags on your page [code] <INPUT TYPE="BUTTON" name="MyPageButton"> <INPUT TYPE="TEXT" name="MyTextBox"> [/code] Then you implement the code to listen for events on it. [code] ' Note this should be declared atleast at form scope Dim WithEvents btnMyButton As HTMLButtonElement ' btnMyButton now contains a reference to the MyPageButton control Set btnMyButton = wbCtrl.Document.all("MyPageButton") ' Sink the onclick event Private Function btnMyButton _onclick() As Boolean ' You can then extract any data from the page here ' or execute a vbscript/jscript function in the page End Function [/code] 2. Requires access to the DOM of the page so you can query the controls for their current values/state. [code] ' Following on from the previous code example, you can now implement the functionality to access the DOM contents ' Sink the onclick event Private Function btnMyButton _onclick() As Boolean dim txtMyTextBox as HTMLInputButtonElement ' Create a reference to the textbox page element set txtMyTextBox = wbCtrl.Document.all("MyTextBox") ' Display the text boxes value string in a message box MsgBox txtMyTextBox .value ' You get the idea... End Function [/code] I haven't tested this code, it's just an approximation of what you need to do. | June 18, 2005, 3:55 AM |