Hello everyone!

Here is my question:


When embedding Mozilla , folling the codes of MFCEmbedded, I Impelement


the nsIWebProgressListener interface , and I want to get the title of a


page to determin whether it goes right in function OnStateChange.Here
is

my codes:

 if (progressStateFlags & STATE_START)
 {
    if (progressStateFlags & STATE_IS_NETWORK)
    {
          mTotalRequests = 0;
          mFinishedRequests = 0;
    }
    if (progressStateFlags & STATE_IS_REQUEST)
    {
          ++mTotalRequests;
    }
 }
 else
 {
    if (progressStateFlags & STATE_STOP)
    {
        if (progressStateFlags & STATE_IS_DOCUMENT)
        {
           if ( (mFinishedRequests + 1) <=mTotalRequests )
           {
              ++mFinishedRequests;
           }
        }
    }
 }
if ( (progressStateFlags & nsIWebProgressListener::STATE_START)
    && (progressStateFlags &nsIWebProgressListener::STATE_IS_DOCUMENT)
)
{
        return NS_OK;
}

if (!progress)
{
        return NS_OK;
}
else
{
    PRBool docLoading;
    progress->GetIsLoadingDocument(&docLoading);
    if (docLoading == PR_TRUE)
    {
         //OutputDebugString(_T("Our page is stillloading...\n"));
          return NS_OK;
    }
}

if ( (mFinishedRequests == mTotalRequests)
 && ( (progressStateFlags &nsIWebProgressListener::STATE_STOP) |
   (progressStateFlags &nsIWebProgressListener::STATE_IS_NETWORK) ))
     && (status == NS_OK))
{
      OutputDebugString(_T("Our page is now loaded...\n"));
        //...
}

first time I kick unter key in the urlEntry , function OnStateChange
was called only once,  only mTotalRequests became 1,and the varible
mFinishedRequests got unchanged.

second time I kick unter key in the urlEntry,  first the varible
mFinishedRequests became 1 and  (progressStateFlags
&nsIWebProgressListener::STATE_STOP) |
   (progressStateFlags &nsIWebProgressListener::STATE_IS_NETWORK)
became true ,but status was not equal to NS_OK,so I can't see the
sentence "Our page is now loaded...\n" in the output.

then function OnStateChange was called , mTotalRequests=1 and
mFinishedRequests =0. It began the second request.

who can help me?

_______________________________________________
mozilla-embedding mailing list
mozilla-embedding@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to