🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #530

Finding out if browser has been scrolled

#530
From: Brian
Date: Thu, 16 Nov 2006 22:55
41 lines
2059 bytes
Hi,

I'm trying to find out if a TCppWebBrowser component has been scrolled 
vertically. I do this by finding the body tag and getting the scrollTop 
property. It works with many pages, but also fail with quite a few 
(get_scrollTop gets the value 0). What am I doing wrong? Navigating to a 
page like www.freebsd.org and scrolling it before all images have been 
loaded will cause get_scrollTop to return 0 when the downloading has 
completed.

      IHTMLDocument2 *Doc;
      if(SUCCEEDED(web->Document->QueryInterface(IID_IHTMLDocument2, 
(LPVOID*)&Doc)))
      {
        IHTMLElement *lpBodyElm = NULL;
        IHTMLElement2 *lpBody  = NULL;

        try
        {
         if( SUCCEEDED(Doc->get_body(&lpBodyElm)) )
         {
          if( 
SUCCEEDED(lpBodyElm->QueryInterface(IID_IHTMLElement2,(void**)&lpBody)) )
          {
           if( !SUCCEEDED(lpBody->get_scrollTop( &current_y)) )
           {
            // never seem to happen
           }
           lpBody->Release();
          }
          lpBodyElm->Release();
         }
        }
        catch(...)
        {
        }
     }


Thanks in advance,
Brian
Technical Details
Message-ID: <455cec6e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,cd8364cfaf34deb1,start
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Brian" <no@spam.please.com>
Newsgroups: borland.public.cppbuilder.internet.web
Subject: Finding out if browser has been scrolled
Date: Thu, 16 Nov 2006 23:55:43 +0100
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 212.242.60.166
Message-ID: <455cec6e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1163717742 212.242.60.166 (16 Nov 2006 14:55:42 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail