• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

IE Navigation from IE Tool Bar developed in Delphi through TWebBrowser Control

I have embedded a TWebBrowser control in my IE Tool (being developed in Delphi) to have a marquee of news headlines with hyperlinks. Now I need to capture the Hyperlink clicked in WebBrowser control and navigate Internet Explorer to that link. I need your expert samples to achieve this. Thanks a lot in advance for all your support in IE tool bar development.
0
SHAHEEN_AKHTAR
Asked:
SHAHEEN_AKHTAR
1 Solution
 
torimarCommented:
Hi,

I haven't been able to test it (no Delphi here on this workstation), but the following code should give you an idea on how to proceed.
Theoretically, all you need to do is code an event handler for the TWebBrowser.OnBeforeNavigate2 event and send the URL clicked by the user to IE via shellexecute.

Here's some sample code:
procedure TForm1.WebBrowser1.BeforeNavigate2(Sender: TObject; const pDisp: IDispatch; var URL,  Flags, TargetFrameName, PostData, Headers: OleVariant;
  var Cancel: WordBool);
begin
  ShellExecute(self.WindowHandle,'open',PChar(string(URL)),nil,nil, SW_SHOWNORMAL);
end;

Open in new window

0
 
SHAHEEN_AKHTARAuthor Commented:
Kindly check posts on my question TWebBrowser Events Capture.
That addressed all my problems. This may also help you for similar tasks.

Thanks a lot
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now