webbrowser 如何获取iframe框架中的源代码
iframe打开的网页是动态的 期待高手大驾光临!!!
------解决方案-------------------- C#实现MyIInternetSecurityManager返回同一个getsecurityid即可访问框架页内容以及获取源码扥等。
c++直接重写MyIInternetSecurityManager::GetSecurityId
STDMETHODIMP MyIInternetSecurityManager::GetSecurityId(LPCWSTR pwszUrl, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
{
#define MY_SECURITY_DOMAIN "file:"
int cbSecurityDomain = strlen(MY_SECURITY_DOMAIN);
if (*pcbSecurityId >= MAX_SIZE_SECURITY_ID)
{
memset(pbSecurityId, 0, *pcbSecurityId);
strcpy((char*)pbSecurityId, MY_SECURITY_DOMAIN);
// Last 4 bytes are <URLZONE> and then 3 zeros.
pbSecurityId[ cbSecurityDomain + 1 ] = URLZONE_LOCAL_MACHINE;
pbSecurityId[ cbSecurityDomain + 2 ] = 0;
pbSecurityId[ cbSecurityDomain + 3 ] = 0;
pbSecurityId[ cbSecurityDomain + 4 ] = 0;
*pcbSecurityId = (DWORD) cbSecurityDomain + 4; // plus the 4 bytes from above.
}
return S_OK;
}
VB引用internet control和html object libray的支持,即可实现框架内部访问。
Private Function getFrames(ByVal WB As WebBrowser) As Object
Dim pContainer As olelib.IOleContainer
Dim pEnumerator As olelib.IEnumUnknown