Solved

Getting and setting IE home page

Posted on 2004-08-24
1
154 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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now