Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 04-21-2001, 03:42 AM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default How to connect to a network shared dir by entering the password?

Let's say that I have a shared dir on a computer called "Mine" and I want to access that from my computer "Zomis" (the shared dir is called "Games" and the password is "delphi")
I want to see if \\Mine\Games\Zomis.txt exists..
I know that I can use
if FileExists('\\Mine\Games\Zomis.txt') then
begin
...
end;

but I want to know this:
- How to do so delphi enters the password?
- How to change the password on "Mine" (by using delphi)

remember that these things are just examples, but I still have the same situation...

Regards,

Zomis
Reply With Quote
  #2  
Old 04-21-2001, 11:54 AM
Tavares Tavares is offline
Senior Member
 
Join Date: Feb 2001
Posts: 1,318
Default RE: How to connect to a network shared dir by entering the password?

What Operating System are you using?
Because if you are logged in a NT you can simply use
IF fileexists('\\machine\share\text.txt') then
because you are already logged.
But if you dont have permission to do this then you can't do anything.

Regards,
Eduardo Tavares
www.tavareswebsite.cjb.net
Reply With Quote
  #3  
Old 04-23-2001, 01:53 AM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: RE: How to connect to a network shared dir by entering the password?

I use Win98, I'm making a sort of LAN version of netaddress (e-mail)
And I can't figure out how to use the socket components so this is the only way I can make it, that's why I must protect the share with a password (so users can't delete everything, because it's read and write access so Delphi can use it...)

If someone knows a good and easy network component that can send TStrings...

Regards,
Zomis
Reply With Quote
  #4  
Old 04-26-2001, 09:57 AM
tristant tristant is offline
Junior Member
 
Join Date: Feb 2001
Posts: 4
Default RE: How to connect to a network shared dir by entering the password?

This function will map you to a network drive using Windows API...


procedure MapNetworkDrive(Drive, ServerDir, UserName,
PassWord: string);
var
NetResource: TNetResource;
begin
{ fill our TNetResource record structure }
NetResource.dwType := RESOURCETYPE_DISK;
NetResource.lpLocalName := Drive; // i.e: 'S:'
NetResource.lpRemoteName := ServerDir //'\\server\public';
NetResource.lpProvider := '';

{ map our network drive using our TNetResource
record structure }
WNetAddConnection2(NetResource,
PassWord,
UserName,
CONNECT_UPDATE_PROFILE);
end;
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 09:32 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.