Mega Code Archive

 
Categories / Delphi / LAN Web TCP
 

Internet explorer [-launch url -launch e-mail program -set homepage --get ie favourites]

-launch url shellexecute(application.handle,'open',pchar('http://www.crashme.com'),nil,nil,sw_show); ------------------------------------------------------------------------------------------------------------------- -launch e-mail program shellexecute(application.handle,'open',pchar('mailto:bill-gates@microsoft.com?Subject=An Error Occured In Windows'),nil,nil,sw_show); ----------------------------------------------------------------------------------------------------------------- -set homepage procedure TForm1.Button1Click(Sender: TObject); var Registry: TRegistry; begin Registry:=TRegistry.Create; Registry.RootKey:=HKEY_CURRENT_USER; Registry.OpenKey('\SOFTWARE\Microsoft\Internet Explorer\Main',False); Registry.WriteString('RegisteredOrganization', Edit1.Text); Registry.Free; end; ---------------------------------------------------------------------------------------------------------------- --get ie favourites uses ShlObj; function GetIEFavourites(const favpath: string): TStrings; var searchrec: TSearchrec; str: TStrings; path, dir, filename: string; Buffer: array[0..2047] of char; found: integer; begin str := TStringList.Create; //Get all file names in the favourites path path := FavPath + '\*.url'; dir := ExtractFilepath(path); found := FindFirst(path, faAnyFile, searchrec); while found = 0 do begin //Get now URLs from files in variable files SetString(filename, Buffer, GetPrivateProfileString('InternetShortcut', PChar('URL'), nil, Buffer, SizeOf(Buffer), PChar(dir + searchrec.Name))); str.Add(filename); found := FindNext(searchrec); end; //unterordner finden found := FindFirst(dir + '\*.*', faAnyFile, searchrec); while found = 0 do begin if ((searchrec.Attr and faDirectory) > 0) and (searchrec.Name[1] <> '.') then str.AddStrings(GetIEFavourites(dir + '\' + searchrec.Name)); found := FindNext(searchrec); end; FindClose(searchrec); Result := str; end; procedure TForm1.Button1Click(Sender: TObject); var pidl: PItemIDList; FavPath: array[0..MAX_PATH] of char; begin SHGetSpecialFolderLocation(Handle, CSIDL_FAVORITES, pidl); SHGetPathFromIDList(pidl, favpath); ListBox1.Items := GetIEFavourites(StrPas(FavPath)); end; ------------------------------------------------------------------------------------------