Solved

Getting and setting IE home page

Posted on 2004-08-24
1
158 Views
Last Modified: 2010-04-04
Hi,

How can I programmatically get and set the home page URL of Internet Explorer?  I need something such as...

function GetIEHomePage: string;
procedure SetIEHomePage(URL: string);

The code needs to reliably work with IE 5 and greater and handle any errors appropriately.  Setting the home page would only be done if the user requests it.

Thanks in Advance,

Richard
0
Comment
Question by:Richard2000
1 Comment
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 50 total points
ID: 11887174
There you go, the functions are just like you wanted them:

uses
  Registry, SysUtils;

//*** To get/set Internet Explorer Home Page read/write this key
//HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
function GetIExplorerHomePage:string;
var
  Reg:TRegistry;
begin
  Reg:=TRegistry.Create;
  try
    if (Reg.OpenKeyReadOnly('\Software\Microsoft\Internet Explorer\Main')) then
      Result:=Reg.ReadString('Start Page')
    else
      Result:=''
  finally
    Reg.Free
  end
end;

procedure SetIExplorerHomePage(NewHomePage:string);
var
  Reg:TRegistry;
begin
  Reg:=TRegistry.Create;
  try
    if (Reg.OpenKey('\Software\Microsoft\Internet Explorer\Main', False)) then
      Reg.WriteString('Start Page', NewHomePage)
    else
      raise Exception.Create('Could not access registry key')
  finally
    Reg.Free
  end
end;
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

713 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