🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: submit cppwebbrowser

#359
From: Remy Lebeau (TeamB)
Date: Sun, 10 Dec 2006 22:35
49 lines
2600 bytes
"Amidala" <no-spam@tiffie.net> wrote in message
news:457bd937@newsgroups.borland.com...

> could you give me one example how to use it properly?

See further below.

> I tried myself now with this here, but i had no success.

That is because there is a bug in the HTML that is screwing up the browser's
DOM interfaces.  The image that you are trying to reach is not a direct
child of the form that you want to submit.  There is a hidden text element
in the form that is not closed properly in the HTML, so the image ends up
being a child of that text element instead of the form.  Your code is not
taking that into account, which is why it is not working for you.

Rather than going through the form at all, an easier way to reach the image
would be to use the document's "all" collection instead.  Then you can reach
the image directly regardless of where it is located in the HTML.  For
example.

    TComInterface<IHTMLDocument2> Doc;
    CppWebBrowser1->Document->QueryInterface(IID_IHTMLDocument2,
(LPVOID*)&Doc);
    if( Doc )
    {
        TComInterface<IHTMLElementCollection> All;
        Doc->get_all(&All);
        if( All )
        {
            TVariant item(L"LeftContainer:FormQuickSearch:btnSubmit",
false);
            TVariant index = 0;
            TComInterface<IDispatch> Disp;

            All->item(item, index, &Disp);

            TComInterface<IHTMLElement> Img;
            if( Disp )
                Disp->QueryInterface(IID_IHTMLElement, (LPVOID*)&Img);

            if( Img )
                Img->click();
        }
    }


Gambit
Technical Details
Message-ID: <457c8b75$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <457aeae7@newsgroups.borland.com> <457afe08@newsgroups.borland.com> <457b1654@newsgroups.borland.com> <457ba45e$1@newsgroups.borland.com> <457bd937@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,a854b31ad8a3f21
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <457aeae7@newsgroups.borland.com> <457afe08@newsgroups.borland.com> <457b1654@newsgroups.borland.com> <457ba45e$1@newsgroups.borland.com> <457bd937@newsgroups.borland.com>
Subject: Re: submit cppwebbrowser
Date: Sun, 10 Dec 2006 14:35:28 -0800
Lines: 51
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.83.34.171
Message-ID: <457c8b75$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1165790069 75.83.34.171 (10 Dec 2006 14:34:29 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail