🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: submit cppwebbrowser

#355
From: Amidala
Date: Sat, 09 Dec 2006 20:03
140 lines
5288 bytes
Hi Michael,

thanks for your answer. i tried this code, but in my case it didn't work.

i have an application with one cppwebbrowser and two buttons.

in my first step i load the website with the cppwebbrowser

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   CppWebBrowser1->Navigate(WideString("http://portal.commerzbank.de/cocoon/retail/News/News.aspx"));
}

when the site has loaded i type in that field on the left top "CZ4420"

Then i press button2 with remys code, you gave me.

the site reloads, but nothing else happens. when i klick that form by 
myself, there appears another site with the information i looked for.

why is that? is there no way to let this submit work the same as a mouse 
klick?

amidala




"Michael Harris" <techonos-NO-SPAM-@attbi.com> schrieb im Newsbeitrag 
news:457afe08@newsgroups.borland.com...
> Amidala
>
>    Remy posted the follwing some time ago
>
> void __fastcall TMain::SubmitForm(void)
>    {
>        TComInterface<IHTMLDocument2> Doc;
>        Browser->Document->QueryInterface(IID_IHTMLDocument2,
> (LPVOID*)&Doc);
>        if( Doc )
>        {
>            TComInterface<IHTMLElementCollection> Forms;
>            Doc->get_forms(&Forms);
>            if( Forms )
>            {
>                long count = 0;
>                Forms->get_length(&count);
>
>                for(long x = 0; x < count; ++x)
>                {
>                    TVariant item = x;
>                    TVariant index = 0;
>                    TComInterface<IDispatch> Disp;
>
>                    Forms->item(item, index, &Disp);
>                    if( Disp )
>                    {
>                        TComInterface<IHTMLFormElement> Form;
>                        Disp->QueryInterface(IID_IHTMLFormElement,
>                                                 (LPVOID*)&Form);
>                        if( Form )
>                        {
>                            ShowMessage("Form Found");
>                            Form->submit();
>                            break;
>                        }
>                    }
>                }
>            }
>        }
> void __fastcall TMain::SubmitForm(void)
>    {
>        TComInterface<IHTMLDocument2> Doc;
>        Browser->Document->QueryInterface(IID_IHTMLDocument2,
> 
> (LPVOID*)&Doc);
>        if( Doc )
>        {
>            TComInterface<IHTMLElementCollection> Forms;
>            Doc->get_forms(&Forms);
>            if( Forms )
>            {
>                long count = 0;
>                Forms->get_length(&count);
>
>                for(long x = 0; x < count; ++x)
>                {
>                    TVariant item = x;
>                    TVariant index = 0;
>                    TComInterface<IDispatch> Disp;
>
>                    Forms->item(item, index, &Disp);
>                    if( Disp )
>                    {
>                        TComInterface<IHTMLFormElement> Form;
>                        Disp->QueryInterface(IID_IHTMLFormElement,
>                                      (LPVOID*)&Form);
>                        if( Form )
>                        {
>                            ShowMessage("Form Found");
>                            Form->submit();
>                            break;
>                        }
>                    }
>                }
>            }
>        }
> .
> --
> Michael
>
> "Amidala" <no-spam@tiffie.net> wrote in message 
> news:457aeae7@newsgroups.borland.com...
>> hi,
>>
>> i am looking for a possibility to submit a form in cppwebbrowser. in the 
>> newsgroups i found some delphi code i tried to convert to c++:
>>
>> CppWebBrowser1->OleObject->Document->All->Item("Form1")->Submit;
>>
>> CppWebBrowser1->OleObject->Document->all->item(OleVariant("Form1"))->Submit();
>>
>> CppWebBrowser1->OleObject->Document->Forms->Item(0)->Submit();
>>
>> None of these exmaples works. I always get these errors:
>>
>> [C++ Fehler] Unit1.cpp(123): E2288 Zeiger auf Struktur auf linker Seite 
>> von -> oder von ->* erforderlich
>>
>> Means
>>
>> [C++ Fehler] Unit1.cpp(123): E2288 Pointer to structure on the left site 
>> of -> or of ->* needed
>>
>> I have no idea how to solve this problem. can anybody help me?
>>
>> Amidala
>>
>
> 
Technical Details
Message-ID: <457b1654@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.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
References: <457aeae7@newsgroups.borland.com> <457afe08@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: "Amidala" <no-spam@tiffie.net>
Newsgroups: borland.public.cppbuilder.internet.web
References: <457aeae7@newsgroups.borland.com> <457afe08@newsgroups.borland.com>
Subject: Re: submit cppwebbrowser
Date: Sat, 9 Dec 2006 21:03:21 +0100
Lines: 142
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 84.137.185.233
Message-ID: <457b1654@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1165694548 84.137.185.233 (9 Dec 2006 12:02:28 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.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