get_document fails with Access is denied with IFrame's

whats the problem ?, i took most of this code from microsoft's site.

thanks,
lee.

I wait for if (dispidMember == DISPID_DOCUMENTCOMPLETE)
parse the html page ok, look for frames and process those, which usually works but i've found IFrames makes it fall over with Access is Denied.

VARIANT frameRequested;
VARIANT frameOut;
IHTMLFramesCollection2* pFramesCol = NULL;
IHTMLWindow2* pRightFrameWindow = NULL;
IHTMLDocument2* pRightDoc = NULL;

frameRequested.vt = VT_UINT;

HRESULT hr = spHTML->get_frames(&pFramesCol);
if (FAILED(hr))
{
MessageBox(NULL,_T("no frames"),NULL,NULL);
return FALSE;
}

long len = 0;
pFramesCol->get_length(&len);
if(len==0) return FALSE;

for(int f=0;f<len;f++)
{
MessageBox(NULL,CComBSTR(frames[f]),NULL,NULL);

frameRequested.lVal = f;

hr = pFramesCol->item(&frameRequested, &frameOut);
if (SUCCEEDED(hr)) // frame present
{

hr = frameOut.pdispVal->QueryInterface(IID_IHTMLWindow2, (LPVOID *)&pRightFrameWindow);
if (SUCCEEDED(hr)) // QueryInterface OK
{


hr = pRightFrameWindow->get_document(&pRightDoc);
if (!SUCCEEDED(hr))
{
_com_error e( hr );
MessageBox(NULL, CComBSTR(e.ErrorMessage()),NULL,NULL );
}