Search results for 'Delphi Networking'. 7 post(s) found.
- 2007/09/18 Retrieving all image links from an HTML document
- 2007/09/18 List All Network Drives
- 2007/09/18 How to set the "home page" for the Internet Explorer from Delphi code
- 2007/09/18 How to get get IE favorites
- 2007/09/18 Extracting the domain (host) name from an e-mail address
- 2007/09/18 Download a file from the Internet with progress indicator
- 2007/09/18 Are we connected to the Internet?
Here's how to obtain all image links from an HTML document. The
GetImageLinks procedure fills a TStrings object with the value of the
SRC property of the IMG HTML element.
Note: if the images have relative links, you will have to parse the document url and prepend that to the image src.
Tip submitted by "mrbaseball34" (an About Delphi Programming member).
procedure GetImageLinks(AURL: String; AList: TStrings) ;
var
IDoc : IHTMLDocument2;
strHTML : String;
v : Variant;
x : integer;
ovLinks : OleVariant;
DocURL : String;
URI : TidURI;
ImgURL : String;
IdHTTP : TidHTTP;
begin
AList.Clear;
URI := TidURI.Create(AURL) ;
try
DocURL := 'http://' + URI.Host;
if URI.Path <> '/' then
DocURL := DocURL + URI.Path;
finally
URI.Free;
end;
Idoc:=CreateComObject(Class_HTMLDOcument) as IHTMLDocument2;
try
IDoc.designMode:='on';
while IDoc.readyState<>'complete' do
Application.ProcessMessages;
v:=VarArrayCreate([0,0],VarVariant) ;
IdHTTP := TidHTTP.Create(nil) ;
try
strHTML := IdHTTP.Get(AURL) ;
finally
IdHTTP.Free;
end;
v[0]:= strHTML;
IDoc.write(PSafeArray(System.TVarData(v).VArray)) ;
IDoc.designMode:='off';
while IDoc.readyState<>'complete' do
Application.ProcessMessages;
ovLinks := IDoc.all.tags('IMG') ;
if ovLinks.Length > 0 then
begin
for x := 0 to ovLinks.Length-1 do
begin
ImgURL := ovLinks.Item(x).src;
// The stuff below will probably need a little tweaking
// Deteriming and turning realtive URLs into absolute URLs
// is not that difficult but this is all I could come up with
// in such a short notice.
if (ImgURL[1] = '/') then
begin
// more than likely a relative URL so
// append the DocURL
ImgURL := DocURL + ImgUrl;
end
else
begin
if (Copy(ImgURL, 1, 11) = 'about:blank') then
begin
ImgURL := DocURL + Copy(ImgUrl, 12, Length(ImgURL)) ;
end;
end;
AList.Add(ImgURL) ;
end;
end;
finally
IDoc := nil;
end;
end;
//Usage
procedure TForm1.Button1Click(Sender: TObject) ;
begin
GetImageLinks('http://kurapa.com', Memo1.Lines) ;
end;
Another posts included in "Delphi"
| How to Activate/Deactivate the Screen Saver (0) | 2007/09/19 |
| How to capture the output from a DOS (command/console) Window (0) | 2007/09/19 |
| How to Change the Windows Start button bitmap (0) | 2007/09/19 |
| List All Network Drives (0) | 2007/09/18 |
| How to set the "home page" for the Internet Explorer from Delphi code (0) | 2007/09/18 |
| How to get get IE favorites (0) | 2007/09/18 |
| Extracting the domain (host) name from an e-mail address (0) | 2007/09/18 |
| Download a file from the Internet with progress indicator (0) | 2007/09/18 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/28 23:05
moneyideas
-
Subject different money making ideas
2010/01/29 07:09
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
To show a list of all mapped Network Drives, use the GetNetworkDriveMappings function. Example usage:
GetNetworkDriveMappings(Memo1.Lines) ;
var
c: Char;
ThePath: string;
MaxNetPathLen: DWord;
begin
SList.Clear;
MaxNetPathLen := MAX_PATH;
SetLength(ThePath, MAX_PATH) ;
for c := 'A' to 'Z' do
if WNetGetConnection(PChar('' + c + ':'), PChar(ThePath),MaxNetPathLen) = NO_ERROR then sList.Add(c + ': ' + ThePath) ;
Result := SList.Count;
end;
Another posts included in "Delphi"
| Retrieving all image links from an HTML document (0) | 2007/09/18 |
| How to Activate/Deactivate the Screen Saver (0) | 2007/09/19 |
| How to capture the output from a DOS (command/console) Window (0) | 2007/09/19 |
| How to set the "home page" for the Internet Explorer from Delphi code (0) | 2007/09/18 |
| How to get get IE favorites (0) | 2007/09/18 |
| Extracting the domain (host) name from an e-mail address (0) | 2007/09/18 |
| Download a file from the Internet with progress indicator (0) | 2007/09/18 |
| Are we connected to the Internet? (0) | 2007/09/18 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 02:56
moneyideas
-
Subject different money making ideas
2010/01/29 12:03
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
How to set the "home page" for the Internet Explorer from Delphi code

Here's how to change the home page for the IE from Delphi code (IE-Tools-Internet options...)
...
function SetIEHomePage(PageName: string): Boolean;
begin
with TRegistry.Create do
try
RootKey := HKEY_CURRENT_USER;
OpenKey('Software\Microsoft\Internet Explorer\Main', False) ;
try
WriteString('Start Page', PageName) ;
Result := True;
except
Result := False;
end;
CloseKey;
finally
Free;
end;
end;
//Usage:
SetIEHomePage('http://kurapa.com')
Another posts included in "Delphi"
| List All Network Drives (0) | 2007/09/18 |
| Retrieving all image links from an HTML document (0) | 2007/09/18 |
| How to Activate/Deactivate the Screen Saver (0) | 2007/09/19 |
| How to get get IE favorites (0) | 2007/09/18 |
| Extracting the domain (host) name from an e-mail address (0) | 2007/09/18 |
| Download a file from the Internet with progress indicator (0) | 2007/09/18 |
| Are we connected to the Internet? (0) | 2007/09/18 |
| Rotate Bitmap (any angle, any center of rotation) (0) | 2007/09/11 |
Trackback : Cannot send a trackbact to this post.
-
Subject Tramadol drug concerns.
2009/06/28 08:33
Tramadol hydrochloride. Cheapest tramadol. Tramadol withdraw. Tramadol side affects. Tramadol. Hydrocodone vs tramadol.
-
Subject different money making ideas
2010/01/28 23:22
moneyideas
-
Subject different money making ideas
2010/01/29 07:27
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
The GetIEFavourites function called from the OnClick event of a button returns a list of all the favorites from your Internet Explorer in a ListBox.
(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;
try
path:=FavPath+'\*.url';
dir:=ExtractFilePath(path) ;
found:=FindFirst(path,faAnyFile,searchrec) ;
while found=0 do begin
SetString(filename, Buffer,
GetPrivateProfileString('InternetShortcut',
PChar('URL'), NIL, Buffer, SizeOf(Buffer),
PChar(dir+searchrec.Name))) ;
str.Add(filename) ;
found:=FindNext(searchrec) ;
end;
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) ;
finally
Result:=str;
end;
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;
Another posts included in "Delphi"
| How to set the "home page" for the Internet Explorer from Delphi code (0) | 2007/09/18 |
| List All Network Drives (0) | 2007/09/18 |
| Retrieving all image links from an HTML document (0) | 2007/09/18 |
| Extracting the domain (host) name from an e-mail address (0) | 2007/09/18 |
| Download a file from the Internet with progress indicator (0) | 2007/09/18 |
| Are we connected to the Internet? (0) | 2007/09/18 |
| Rotate Bitmap (any angle, any center of rotation) (0) | 2007/09/11 |
| TImage.Bitmap fade out (0) | 2007/09/11 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 06:03
moneyideas
-
Subject different money making ideas
2010/01/29 14:35
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
Extracting the domain (host) name from an e-mail address

If you have an email as a string value and want to extract only the domain (host) name from it, like in: "delphi.guide@about.com" - domain name = "about.com", you can use the next function:
function EmailDomain(const email: string):string;
var
Pos_AT : integer;
begin
Pos_AT := Pos('@', email) ;
Result := Copy(email, Pos_AT + 1, Length(email) - Pos_AT)
end;
Another posts included in "Delphi"
| How to get get IE favorites (0) | 2007/09/18 |
| How to set the "home page" for the Internet Explorer from Delphi code (0) | 2007/09/18 |
| List All Network Drives (0) | 2007/09/18 |
| Download a file from the Internet with progress indicator (0) | 2007/09/18 |
| Are we connected to the Internet? (0) | 2007/09/18 |
| Rotate Bitmap (any angle, any center of rotation) (0) | 2007/09/11 |
| TImage.Bitmap fade out (0) | 2007/09/11 |
| TDesktopCanvas - draw on Windows Desktop (0) | 2007/09/11 |
Trackback : Cannot send a trackbact to this post.
-
Subject Lexapro.
2009/02/08 18:29
Can you take lexapro while pregnant.
-
Subject Viagra.
2009/02/11 22:31
Buy viagra.
-
Subject Viagra.
2009/03/01 14:04
Viagra. Generic viagra no prescription. Buy viagra.
-
Subject different money making ideas
2010/01/29 02:55
moneyideas
-
Subject different money making ideas
2010/01/29 11:51
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
Download a file from the Internet with progress indicator

If you need to save the contents of a specified URL to a file - and be able to track the download progress, use the TDownloadURL Delphi action
While TDownloadURL is writing to the specified file, it periodically generates an OnDownloadProgress event, so that you can provide users with feedback about the process.
Here's an example - note that you must include the unit ExtActns in the uses clause.
type
TfrMain = class(TForm)
...
private
procedure URL_OnDownloadProgress
(Sender: TDownloadURL;
Progress, ProgressMax: Cardinal;
StatusCode: TURLDownloadStatus;
StatusText: String; var Cancel: Boolean) ;
...
implementation
...
procedure TfrMain.URL_OnDownloadProgress;
begin
ProgressBar1.Max:= ProgressMax;
ProgressBar1.Position:= Progress;
end;
function DoDownload;
begin
with TDownloadURL.Create(self) do
try
URL:='http://z.about.com/6/g/delphi/b/index.xml';
FileName := 'c:\ADPHealines.xml';
OnDownloadProgress := URL_OnDownloadProgress;
ExecuteTarget(nil) ;
finally
Free;
end;
end;
{
Note:
URL property points to Internet
FileName is the local file
}
Another posts included in "Delphi"
| Extracting the domain (host) name from an e-mail address (0) | 2007/09/18 |
| How to get get IE favorites (0) | 2007/09/18 |
| How to set the "home page" for the Internet Explorer from Delphi code (0) | 2007/09/18 |
| Are we connected to the Internet? (0) | 2007/09/18 |
| Rotate Bitmap (any angle, any center of rotation) (0) | 2007/09/11 |
| TImage.Bitmap fade out (0) | 2007/09/11 |
| TDesktopCanvas - draw on Windows Desktop (0) | 2007/09/11 |
| TColor to HTML color (0) | 2007/09/11 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 04:06
moneyideas
-
Subject different money making ideas
2010/01/29 12:54
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
Here's how to check whether you are connected to the Internet
function FuncAvail(_dllname, _funcname: string; var _p: pointer): boolean;
{return True if _funcname exists in _dllname}
var _lib: tHandle;
begin
Result := false;
if LoadLibrary(PChar(_dllname)) = 0 then exit;
_lib := GetModuleHandle(PChar(_dllname)) ;
if _lib <> 0 then begin
_p := GetProcAddress(_lib, PChar(_funcname)) ;
if _p <> NIL then Result := true;
end;
end;
{
Call SHELL32.DLL for Win < Win98
otherwise call URL.DLL
}
{button code:}
var
InetIsOffline : function(dwFlags: DWORD):
BOOL; stdcall;
begin
if FuncAvail('URL.DLL', 'InetIsOffline',
@InetIsOffline) then
if InetIsOffline(0) = true
then ShowMessage('Not connected')
else ShowMessage('Connected!') ;
end;
Another posts included in "Delphi"
| Download a file from the Internet with progress indicator (0) | 2007/09/18 |
| Extracting the domain (host) name from an e-mail address (0) | 2007/09/18 |
| How to get get IE favorites (0) | 2007/09/18 |
| Rotate Bitmap (any angle, any center of rotation) (0) | 2007/09/11 |
| TImage.Bitmap fade out (0) | 2007/09/11 |
| TDesktopCanvas - draw on Windows Desktop (0) | 2007/09/11 |
| TColor to HTML color (0) | 2007/09/11 |
| Show *any* graphics as Glyph on a SpeedButton (0) | 2007/09/11 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 02:08
moneyideas
-
Subject different money making ideas
2010/01/29 10:14
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
Prev

Rss Feed