🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14884

Re: Need help with this code...(2)

#14884
From: Remy Lebeau (TeamB)
Date: Tue, 29 Jul 2003 18:39
46 lines
2376 bytes
"micheal davis" <micheal_davis@hotmail.com> wrote in message
news:3f268dd9@newsgroups.borland.com...

> I enclosed the Pascal code and the C++ code after I trying to translate...

    AnsiString __fastcall GetText(HWND WindowHandle)
    {
        int txtLength;
        AnsiString buffer;

        txtLength = ::SendMessage(WindowHandle, WM_GETTEXTLENGTH, 0, 0) + 1;
        buffer.SetLength(txtLength);
        ::SendMessage(WindowHandle, WM_GETTEXT, txtLength,
(LPARAM)buffer.c_str());

        return buffer;
    }

    AnsiString __fastcall GetURL()
    {
        HWND ie, worker, toolbar, comboboxex, combo, edit;

        ie = ::FindWindow("IEFrame", NULL);
        worker = ::FindWindowEx(ie, 0, "WorkerA", NULL);
        toolbar = ::FindWindowEx(worker, 0, "ReBarWindow32", NULL);
        comboboxex = ::FindWindowEx(toolbar, 0, "ComboBoxEx32", NULL);
        combo = ::FindWindowEx(comboboxex, 0, "ComboBox", NULL);
        edit = ::FindWindowEx(combo, 0, "Edit", NULL);

        return GetText(edit);
    }

    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
        ShowMessage(GetURL());
    }

BTW, there is a much easier way to obtain the current URL from IE.  Use DDE
instead, for example:

http://groups.google.com/groups?q=borland+remy+internet+explorer+dde&hl=en&l
r=&ie=UTF-8&oe=UTF-8&selm=3e1e2b12%241%40newsgroups.borland.com&rnum=1


Gambit
Technical Details
Message-ID: <3f26be21@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f268dd9@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,58a7894f639848fb
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-29 11:40:41 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f268dd9@newsgroups.borland.com>
Subject: Re: Need help with this code...(2)
Date: Tue, 29 Jul 2003 11:39:57 -0700
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3f26be21@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1059503649 207.175.226.26 (29 Jul 2003 11:34:09 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail