下面的代码实现了IE里有的“查看源文件”的功能void cmybrowser::onviewsource() { cwnd* pwnd = null; cwnd* pwndshell = m_webbrowser2.getwindow(gw_child); // get the webbrowser window pointer if (pwndshell) { pwnd = pwndshell->getwindow(gw_child); //get the child window pointer }
if(pwnd != null) { wparam wparam = makelong(idm_viewsource, 1); //convert to unsigned 32 bit value and pass it to wparam pwnd->sendmessage(wm_command, wparam, (lparam)pwndhtml->m_hwnd); //cool send a message to retreive the source. } }
{
cwnd* pwnd = null; cwnd* pwndshell = m_webbrowser2.getwindow(gw_child); // get the webbrowser window pointer if (pwndshell)
{
pwnd = pwndshell->getwindow(gw_child); //get the child window pointer
}
if(pwnd != null)
{
wparam wparam = makelong(idm_viewsource, 1); //convert to unsigned 32 bit value and pass it to wparam
pwnd->sendmessage(wm_command, wparam, (lparam)pwndhtml->m_hwnd); //cool send a message to retreive the source.
}
}