Re: Retriving a value from a hidden text field (HTML)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: fernando (FatalError0x4c_at_hotmail.com)
Date: 02/20/04


Date: Fri, 20 Feb 2004 10:26:41 -0300

i think this line
_stprintf(sPort, _T("%s"), (LPCTSTR)pValuePort);

only works if UNICODE is defined, if thats not the case u should do
USES_CONVERSION;
_stprintf(sPort, _T("%s"), OLE2CT(pValuePort));

bye

"Mash" <anonymous@discussions.microsoft.com> escreveu na mensagem
news:153EA1AB-AE90-4881-9B47-3C1C4E64C12F@microsoft.com...
> I am trying to read an html page and retrieve the value of three hidden
input fields sure as:
> <input name=port type=hidden value=1500>
>
> Below is the code I am working with to read in the value (1500) but it is
not working. I think i am missing something.
>
> HRESULT hr;
> TCHAR sPort[25];
> IDispatch* pElemDisp = NULL;
> IHTMLInputHiddenElement* pElem = NULL;
> IHTMLElementCollection *pElemcoll;
>
> // Get the WebBrowser's document object
> CComPtr<IDispatch> pDisp;
> HRESULT hr = m_spWebBrowser2->get_Document(&pDisp);
> if (FAILED(hr)) return false;
>
> CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTML;
> spHTML = pDisp;
>
> _variant_t tagName("input");
> _variant_t tagNamePort("port");
>
> BSTR* pValuePort = NULL;
>
> spHTML->get_forms(&pElemcoll);
>
> hr = pElemColl->tags( tagName, &pElemDisp );
> if ( SUCCEEDED(hr) )
> {
> hr = pElemDisp->QueryInterface( IID_IHTMLInputHiddenElement,
(void**)&pElem );
> if ( SUCCEEDED(hr) )
> {
> hr = pElem->get_value(pValuePort);
> if ( SUCCEEDED(hr) )
> {
> //Set port
> _stprintf(sPort, _T("%s"), (LPCTSTR)pValuePort);
> m_sPort = (int)sPort;
> }
> pElem->Release();
> }
> pElemDisp->Release();
> }
>
> //at this point m_sPort is NULL not 1500 :-(
>
> Thank you for any help you can give.. mash



Relevant Pages

  • Re: Shift_JIS conflict with CSS?
    ... dreadfully convoluted HTML, however with OO the only cluttering it did ... I had which understood UTF-8 was JWPce. ... stuff and resave the file without any corruption of the unicode. ... The bottom line is that if you want a plain text editor that can input ...
    (sci.lang.japan)
  • Re: Question about unicode in internet explorer and notepad
    ... This mean that the code page for the text in the HTML uses the standard ASCII character set - windows-1252 ... Because the browser can understand this meta tag you get Unicode characters in the displayed HTML. ... > Then, I save notepad, but when I do so I recieve a message ...
    (microsoft.public.win2000.general)
  • Re: Some OE6 News Posts Are Unreadable
    ... Unicode problem reported for OE5 in that article. ... I did try a couple of posts from the laptop last night and did as the ... does it also show the Unicode in the HTML section as ... it from the news server, do you still see Unicode it if was originally ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: decoding character encoding confusion
    ... Unicode, etc.; since you have two different encodings, you need two ... The files aren't that big but "real time" performance is required so any ... decriptive text I may just forget about the HTML step and just leave as-is. ...
    (microsoft.public.vc.mfc)
  • Re: FSO Issues with Unicode
    ... support in the HTML Help Compiler was to change the meta tag to UTF-8. ... Have you found an example of a CHM file that was done in Unicode? ...
    (microsoft.public.scripting.vbscript)