?
Solved

Intercept clicks from browsers

Posted on 1999-12-12
6
Medium Priority
?
229 Views
Last Modified: 2010-04-06
How do I intercept clicks on certain file-types in IE and Netscape? (like all download-managers does)
0
Comment
Question by:jonassondaniel
6 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 200 total points
ID: 2275347
hi,
you just need to register your file types in the registry,so when a link to a file of type .txt is clicked it will open in your app instead of notepad.you can use some code liike this to do it:

procedure RegisterFile;

var Reg: TRegistry;

begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CLASSES_ROOT;
    Reg.OpenKey('\.txt', True);
    Reg.WriteString('', 'MyProgram');
    Reg.OpenKey('\MyProgram', True);
    Reg.WriteString('', 'a very special file');
    Reg.OpenKey('\MyProgram\DefaultIcon', True);
    Reg.WriteString('', Application.ExeName + ', 1');
    Reg.OpenKey('\MyProgram\Shell\open\command', True);
    Reg.WriteString('', Application.ExeName + ' "%1"');
    ShowMessage('successfully registered');
  finally
    Reg.Free;
  end;
end;

Regards Barry
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2275586
Your a very clever man Barry :)
0
 

Author Comment

by:jonassondaniel
ID: 2276405
Yes, that will start my program when a certain file is clicked, but how do I get the file-url and stop IE or Netscape from downloading that file?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
LVL 17

Expert Comment

by:inthe
ID: 2278112
this stopping should happen automaticaly because your program is handling it..
to get the paths/url call ParamStr(1);

ie:
memo1.lines.add(ParamStr(1));

or in a loop if need be:

var
  I: Word;
begin
  for I := 0 to ParamCount do begin
    memo1.lines.add(ParamStr(I));
   end;
end;
0
 
LVL 2

Expert Comment

by:DarrinE
ID: 5381403
the answer to this question is not correct and is a waste of points - does anyone mind if it is deleted and I can reclaim my points  ??

DarrinE
0
 
LVL 17

Expert Comment

by:inthe
ID: 5390239

look at the browser helper object here:

http://www.euromind.com/iedelphi/ie5tools/bho.htm

0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…
Suggested Courses

607 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