|
-
Mar 20th, 2001, 11:02 PM
#1
Thread Starter
New Member
Can someone please tell me how I can access a shared file on the network that is protected by a password. If I set up the folder with out password protection then anyone can view. By doing the following:
\\computername\sharedfoldername\readme.txt
But how do I access this file 'readme.txt' if I password protect that network shared folder. The above path does not work when a password is in place.
Any help would be appreciated.
Thanks,
Zoran
-
Mar 20th, 2001, 11:17 PM
#2
Try this
Option Explicit
Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Private Sub Form_Load()
WNetAddConnection "\\SomeComputer\SomeFolder\", "Password", "T:"
End Sub
This code will add a network connection to a computer.
The first parameter is the path,
second: Passowrd
third: Local drive name (here you have to type in a letter and a semicolon, the drive should be available otherwise it will give an error)
Once you have don that, you can do file operations on it
eg
Kill "T:\SomeFile.txt"
After performing your operrations type:
WNetCancelConnection "T:", True
-
Mar 20th, 2001, 11:33 PM
#3
Thread Starter
New Member
Thank you very much Yash. I will give it a try tomorrow. It has been a long day.....I had many computer problems to resolve today...
I guess there is no switch I can add to the path kind of like
\\ComputerName\ShareFolder\readme.txt /p password
or
\\ComputerName\ShareFolder\readme.txt -password
Thanks again for your help.....
Zoran
-
Mar 20th, 2001, 11:37 PM
#4
Yeah, you can add add a connection to anything. If that share has a password then add the passowrd in the parameter, if it does'nt, leave it blank
-
Mar 21st, 2001, 12:02 AM
#5
Thread Starter
New Member
Sorry to bother you again Yash, but I noticed that you called a function
WNetCancelConnection "T:", True
Do you need to declare this function like you did the other one....WNetAddConnection
Thanks,
Zoran
-
Mar 21st, 2001, 12:04 AM
#6
PowerPoster
I think he posted the declaration twice by accident, which should refer to the cancel function
-
Mar 21st, 2001, 12:09 AM
#7
YEah, i Did
Private Declare Function WNetCancelConnection Lib "mpr.dll" Alias "WNetCancelConnectionA" (ByVal lpszName As String, ByVal bForce As Long) As Long
Add this
-
Mar 21st, 2001, 12:12 AM
#8
Thread Starter
New Member
Thanks, that makes sense.
Zoran
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|