Connect to another pc using delphi

HI,

  I want to connect to a system which is in lan. i will supply username and password required also. i want to download the files from that machine to my machine. Can any body gives Delphi code snippet to do this.
sbondalapatiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cyberkiwiCommented:
This first link will show you how to perform authentication in Delphi
http://koti.mbnet.fi/akini/delphi/ntlmlogin/

The second one will show you how to copy a file now that you have authenticated
http://www.efg2.com/Lab/Library/UseNet/2001/1028.txt

In actual fact, I would try #2 first and see if Windows be default shows the login prompt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sbondalapatiAuthor Commented:
I tried second solution. But its not connecting directly. First one is too complicated.
0
cyberkiwiCommented:
It may be easier just to map the drive then Delphi can just use the mapped drive letter. Is that possible?
0
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

sbondalapatiAuthor Commented:
I required the code snippet in delphi, which will have all the windows authentications handled correctly.
0
cyberkiwiCommented:
That's where you do need the code from the first link - it is no easy feat to authenticate to AD
0
Mahdi78Commented:
Try INDY FTP Client/Server demo
0
sbondalapatiAuthor Commented:
is FTP Client/Server will work for lan?
0
Mahdi78Commented:
Yeah FTP Client/Server work for LAN, you need to use and set private IP of your local Network
0
malsoftCommented:
Copying files to/from a Windows server is relatively simple if you use the drive mapping option. This also is simple to do if you use the CreateProcess API and call up "net use" with the appropriate username, password and mapping details. I've been using that method to move files around in a service-based process for several months without any problems.
0
Mahdi78Commented:
Try Filezilla Client and Server
http://filezilla-project.org/
0
systanCommented:
Here's my code: (just add 1Listbox)

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    procedure FormCreate(Sender: TObject);
    procedure ListBox1DblClick(Sender: TObject);
  private
    { Private declarations }
    Procedure SharedFolderDrive();
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
uses ShellApi;

{$R *.dfm}

procedure EnumRemoteDrives(Items: TStringlist);
function EnumerateFunc(lpnr: PNetResource; Items: TStringList; DrillDepth: Integer): Boolean;
var
lpnrLocal: PNetResource;
hEnum:THandle;
dwResult, dwResultEnum, cbBuffer, cEntries: DWORD;
i: Integer;
p1:PChar;
p2:PnetResource;
s, t: string;
begin
dwResult := WNetOpenEnum(RESOURCE_GLOBALNET,RESOURCETYPE_DISK, 0, lpnr, hEnum);
if dwResult <> NO_ERROR then begin EnumerateFunc := False;
exit;
end;
cbBuffer := 32768;
cEntries := $FFFFFFFF;
lpnrLocal := PNetResource(GlobalAlloc(GPTR,cbBuffer));
repeat
dwResultEnum := WNetEnumResource(hEnum,cEntries, lpnrLocal, cbBuffer);
if dwResultEnum = NO_ERROR then begin
for i := 0 to cEntries - 1 do begin
p1 := PChar(lpnrLocal) + i *
SizeOf(TNetResource);
p2 := PNetResource(p1);
s := StrPas(p2^.lpRemoteName);
if Length(s) > 2 then
if (s[1] = '\') and
(s[2] = '\') then begin
t := Copy(s,
3, Length(s) - 2);
if Pos('\', t)
<> 0 then
items.Add(s);
end;
if (p2.dwUsage and RESOURCEUSAGE_CONTAINER) = RESOURCEUSAGE_CONTAINER then
if DrillDepth < 3 then
EnumerateFunc(p2, Items, DrillDepth + 1);
end;
end;
until dwResultEnum = ERROR_NO_MORE_ITEMS;
GlobalFree(HGLOBAL(lpnrLocal));
dwResult := WNetCloseEnum(hEnum);
if dwResult <> NO_ERROR then begin EnumerateFunc := False;
 exit;
  end;
EnumerateFunc := True;
end;
begin
EnumerateFunc(nil, Items, 0);
end;

Procedure Tform1.SharedFolderDrive();
var
netx: string;
i: byte;
sl : tstringlist;
begin
sl := tstringlist.create;
EnumRemoteDrives(sl);
for i:= 0 to sl.Count-1 do
begin
netx:=sl[i];
listbox1.items.add(netx);
end;
sl.free;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
SharedFolderDrive;
end;

procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
ShellExecute(Handle,'open', Pchar(listbox1.items[listbox1.itemINdex]), nil, nil, SW_SHOWNORMAL) ;
end;

end.
0
sbondalapatiAuthor Commented:
HI all

 thanks for the solutions.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.