Solved

In Delphi - I need to have a ListBox record the destination URL of the images I click

Posted on 2011-02-19
3
545 Views
Last Modified: 2012-05-11
Thanks for reading

this image depicts the program I need to build:

http://img252.imageshack.us/img252/5069/clickclick.gif

A typical "website photo gallery" will contain thumbnail images which contain an HREF tag which points to the BIGGER version of that picture.

I need to be able to click on this thumbnail image, and have the URL appear in a listbox.

I would like the WebBrowser component to function in no other way. e.g. i don't want it to actually go to the bigger image when I click. I just need the destination URL.

Got any ideas?

Thanks!
0
Comment
Question by:bobbysdog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:maosalah
ID: 34935629
0
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
ID: 34935630
Having Button, WebBrowser and ListBox on the form add the following code:
The code of the WebBrowser is at "OnBeforeNavigate2" and "OnDocumentComplete":
var  //Global variable
  NavigateCompleted:Boolean=False;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Webbrowser1.Navigate('YourMainURL');
end;

procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject;
  const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
  Headers: OleVariant; var Cancel: WordBool);
begin
  if NavigateCompleted then
    begin
      ListBox1.Items.Add(URL);
      Cancel := true;
    end;
end;

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
begin
  NavigateCompleted := true;  // set it to false to be able to navigate other URLs
end;

Open in new window

Please note: to be able to navigate to other URLs you need to set the variable "NavigateCompleted" to False.
0
 

Author Closing Comment

by:bobbysdog
ID: 34935699
wow thanks this is awesome!!!!!!!!!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi: ForceDirectory plain function 7 49
JAudiorecorder record freezing the app 29 82
Convert MS Word document to a PDF file 9 114
How to make Sign in, using Clientdataset? 1 33
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question