Solved

Getting and setting IE home page

Posted on 2004-08-24
1
160 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 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