How to get text input ?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello everybody .<br/>
I have read this reference<br/>
http://msdn.microsoft.com/en-us/library/aa752127%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa752127%28v=vs.85%29.aspx <br/>
http://msdn.microsoft.com/en-us/library/aa768277%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa768277%28v=vs.85%29.aspx <br/>
http://msdn.microsoft.com/en-us/library/aa752574%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa752574%28v=vs.85%29.aspx <br/>
Now , I want to check user input text . If the user enters " http://google.com http://google.com". After "DISPID_BEFORENAVIGATE2" of Internet Explorer Web Browser loaded successfully. it checks if the same " http://google.com http://google.com"
then return "about: blank"<br/>
This is my form HTML

<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>

<pre class="prettyprint <html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252
<title>New Page 1</title>
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--
<label>Website ABC</label>
<br>
<input type="text" name="txt_url" value="http://google.com" size="50
<br>
<textarea name="txt_url2" cols="50" rows="2 http://msdn.com</textarea>
<br>
<input type="checkbox" name="chk_male" value="Male" checked>
<br>
<input type="text" name="T1" size="20
<input type="submit" value="Submit" name="B1
<input type="reset" value="Reset" name="B2
<br>
<input type="submit" name="Ok" value="ok_click
<input type="reset" value="cancel_click" name="Cancel
</form>

</body>

</html>[/code]
<br/>
Note : In this HTML have to three text input<br/>
And this is event code
<pre class="prettyprint STDMETHODIMP ABCtest::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pvarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
USES_CONVERSION;
if(dispidMember == DISPID_BEFORENAVIGATE2)
{
BSTR type_text;
HRESULT result = m_spWebBrowser2->get_Type(&type_text);
if(FAILED(result ))
return result ;

LPTSTR value_text = new TCHAR[SysStringLen(type_text)];
lstrcpy(value_text, OLE2T(type_text));

if(strcmp("http://google.com/",(const char *)value_text) == 0)
{
VARIANT vFlags = {0},vTargetFrameName = {0};
m_spWebBrowser2->Navigate(SysAllocString(L"about:blank"),&vFlags,&vTargetFrameName,NULL,NULL);
m_spWebBrowser2->put_Visible(VARIANT_TRUE);
return S_FALSE;
}
return S_OK;
}
else if(dispidMember == DISPID_NAVIGATECOMPLETE2)
{
BSTR type_text;
HRESULT result = m_spWebBrowser2->get_Type(&type_text);
if(FAILED(result))
return result;

LPTSTR value_text = new TCHAR[SysStringLen(type_text)];
lstrcpy(value_text, OLE2T(type_text));

if(strcmp("http://google.com/",(const char *)value_text) == 0)
{
VARIANT vFlags = {0},vTargetFrameName = {0};
m_spWebBrowser2->Navigate(SysAllocString(L"about:blank"),&vFlags,&vTargetFrameName,NULL,NULL);
m_spWebBrowser2->put_Visible(VARIANT_TRUE);
}
return S_OK;
}
return S_FALSE;
} [/code]
<br/>

You can tell me why it does not check the contents into input text ? <br/>


View the full article
 
Back
Top