🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TWebBrowser how to put_value() for <input type="file">

#727
From: Remy Lebeau (TeamB)
Date: Tue, 31 Oct 2006 18:02
57 lines
3263 bytes
"Hans Galema" <notused@notused.nl> wrote in message
news:45475fb0@newsgroups.borland.com...

> But sending keystrokes took me hours before I had managed that.
> It appears that using keybd_event() for a TEdit is easier then
> to a TWebBrowser.

Do not use keybd_event().  There is no way to gaurantee which window it
directs keystrokes to.  If the user switches windows while keybd_event() is
still running, the keystrokes will go to the wrong window.  You have to use
SendMessage() to ensure the proper window is used.  Also, use WM_KEYDOWN/UP
instead of WM_CHAR.

> Using WM_CHAR like:
>
> SendMessage(WebBrowser1->Handle, WM_CHAR, 'G', 2);
>
> does nothing.
>
>    SendMessage ( WebBrowser1->Handle, WM_KEYDOWN, 'w', 0);
>
> does not work either.

That is because you are sending the messages to the wrong window.  You are
sending them to the browser's container window when you need to send them to
the edit control of the <input> element itself instead.

> This works but only after taking special care for char's like : \ ' . - +

You do not need to do that.  There is nothing "special" about those
characters.  WM_CHAR handles them just fine without special handling.

> Isn't there a function that will convert a char to VK_XXXX ?

No.

> As can be seen in the source op the url tat I provided earlier there is
> javascript onsubmit() to be executed. Will TIdHTTP care for that too?

No, but then again it doesn't need to.  All that script does is disables the
upload button and then pops up a progress window during the upload.  Since
you would be programming to the HTTP protocol directly, there would be no
upload button at all (except in your own UI, if any), and you could show
your own progress information as you have direct access to the connection
that is sending the data to the server.

> At the moment things run. The program can upload a directory with videos
> to the specified url and extract the resulting url's for use in webpages.

All the more reason not to use TWebBrowser at all for that.  It would be a
major bottleneck in that process.  If you go to the HTTP protocol directly,
you can automate the uploading much much cleaner, and eliminate Microsoft's
UI altogether.


Gambit
Technical Details
Message-ID: <4547902c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.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: <45468718@newsgroups.borland.com> <4546982a$1@newsgroups.borland.com> <45475fb0@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,2bc0d92930b979d2
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: <45468718@newsgroups.borland.com> <4546982a$1@newsgroups.borland.com> <45475fb0@newsgroups.borland.com>
Subject: Re: TWebBrowser how to put_value() for <input type="file">
Date: Tue, 31 Oct 2006 10:02:10 -0800
Lines: 59
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: 69.169.4.232
Message-ID: <4547902c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1162317868 69.169.4.232 (31 Oct 2006 10:04:28 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.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