I built a Visual Studio 2008 VC++ project, dialog based using HTML.
In my HTML I have:
<form name="loadExcel">
Choose the file which contains the information:<br />
<input type="file" name="myFile" value="Search" id="myFileInput" /><br />
<input type="button" class="Upload" name="loadExcel" title="Import" id="loadExcelButton" />
</form>
The user is supposed to browse to a valid Excel file which I will work using the excellent ExcelFormat library by Martin Fuchs to produce a XML output.
So, I try to capture the path to the file or at least something using the button loadExcel that will trigger a function:
BEGIN_DHTML_EVENT_MAP(CGeneraliDMDlg)
DHTML_EVENT_ONCLICK(_T("ButtonOK"), OnButtonOK)
DHTML_EVENT_ONCLICK(_T("ButtonCancel"), OnButtonCancel)
DHTML_EVENT_ONCLICK(_T("loadExcelButton"), OnLoadExcel)
END_DHTML_EVENT_MAP()
And here is the code to my function so far:
HRESULT CGeneraliDMDlg::OnLoadExcel(IHTMLElement* pElement){
BSTR bstrText = NULL;
GetElement(_T("myFileInput"), &pElement);
if(pElement){
pElement->get_innerText(&bstrText);
char *Text = _com_util::ConvertBSTRToString(bstrText);
AfxMessageBox(Text);
}
return S_OK;
}
For some reason I don't understand, the Message box is empty, does it mean I'm not capturing anything? can someone give me a little help with this?
To tell the truth, I found the code for the OnLoadExcel function doing some research, but it does not work.
If I do something like pElement->put_outerHTML(blah)
, it works perfect, so i think somehow i'm loosing my information in the way.
In advance, thanks for any help you can give me :D