IHTMLInputFileElement put_value

  • Thread starter Thread starter mesajflaviu
  • Start date Start date
M

mesajflaviu

Guest
I am struggle for a while to put a text inside file input tag in html, using CHtmlView. And I succeeded for any kind of input type, but not for file input type: I have the following html code:

<span>Choose the file:</span> <span> <input type="file" name="linkdoc" size="75" value=""></span><span><input type="submit" value="Send"></span>



and the MFC code:

IHTMLInputFileElement* pInputElem = NULL;
hr = pElemDispatch->QueryInterface(IID_IHTMLInputFileElement, (void**)&pInputElem);
....
....
CString sTemp(sNewValue);
BSTR bstrNewValue = sTemp.AllocSysString();
pInputElem->put_value(bstrNewValue);
SysFreeString(bstrNewValue);


but it simply not change the value ...

I have read the html IHTMLInputFileElement documentation:

IHTMLInputFileElement::put_value
HRESULT put_value(
BSTR v
);
Sets the value of the INPUT file control.

Returns S_OK if successful, or an error value otherwise.
v
String specifying the value.
but is not working ... can anybody tell me how to solve this ? In deed, manually I cannot change this input type valus, only if I go with "Browse" button, and so on ... but my task is to change this value programmatically by my code.

Continue reading...
 
Back
Top