I want to create rows and cells in the CDHtmlDialog. Here is the code my wrote:
void CHtmlTableTestDlg::OnDocumentComplete(LPDISPATCH pDisp, LPCTSTR szUrl)
{
IHTMLTable* table;
this->GetElement(_T("Table"),(IHTMLElement**)&table);
IDispatch* dispatch;
table->insertRow(1,&dispatch);
}
Here is the html of the table:
<table id="Table">
<tr>
<th>Column</th>
</tr>
</table>
I debugged the project and got the error below when execute “table->insertRow(1,&dispatch)”
Unhandled exception at 0x3fa53780 in HtmlTableTest.exe: 0xC0000005: Access violation writing location 0x00000001.
I have uploaded my test project:
http://top720.com/Temp/HtmlTableTest.zip
How to create rows and cells base on the CDHtmlDialog?
Thank you for any helps in in advance.
You can’t just cast between
IHTMLElementandIHTMLTable. Try this:It would also be worth reading an introduction to COM.