Search results for 'WNetGetConnection'. 2 post(s) found.
- 2007/09/18 List All Network Drives
- 2007/09/10 Convert a mapped drive to a full UNC path
To show a list of all mapped Network Drives, use the GetNetworkDriveMappings function. Example usage:
GetNetworkDriveMappings(Memo1.Lines) ;
function GetNetworkDriveMappings (SList: TStrings): integer;
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;
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
Universal/Uniform Naming Convention. A UNC Path describes the location of a volume, directory, or file.
The format for a UNC Path is \\server\volume\directory\file and is not case-sensitive. For example:
\\Shared1_svr\Shared1\WGroups\Network\Orders.xls
Rather than describe the location of a file or directory by drive letter, the Network Group will typically communicate a UNC Path to describe the actual location of a file or directory. Windows drive letter mappings are arbitrary, whereas a UNC Path is specific and applies to all operating systems.
Note: The UNC method started with the UNIX operating system. UNIX uses the forward-slash character as a path separator. Many network services (ex. FTP) have their origins in the UNIX operating system, so they use forward-slashes instead of the backslashes that DOS/Windows uses. It is important to recognize this distinction when using these services.
Usage:
UNCLabel.Caption := ConvertToUNCPath(ExtractFileDrive(Edit1.Text)) ;
Followings are the source can get UNC Path.
function ConvertToUNCPath(MappedDrive: string) : string;
var
RemoteString : array[0..255] of char;
lpRemote : PChar;
StringLen : Integer;
begin
lpRemote := @RemoteString;
StringLen := 255;
If WNetGetConnection(Pchar(ExtractFileDrive(MappedDrive)) ,
lpRemote,
StringLen) = NO_ERROR Then
Result := RemoteString
Else
Result:=''; // Alternatively return an errorcode, Raise an exception or something like end;
end;
var
RemoteString : array[0..255] of char;
lpRemote : PChar;
StringLen : Integer;
begin
lpRemote := @RemoteString;
StringLen := 255;
If WNetGetConnection(Pchar(ExtractFileDrive(MappedDrive)) ,
lpRemote,
StringLen) = NO_ERROR Then
Result := RemoteString
Else
Result:=''; // Alternatively return an errorcode, Raise an exception or something like end;
end;
Another posts included in "Delphi"
| Does my CD-ROM drive contain an audio CD? (0) | 2007/09/10 |
| Delete files with the ability to UNDO (0) | 2007/09/10 |
| Delete folders recursively (0) | 2007/09/10 |
| Checking If File Is In Use (0) | 2007/09/10 |
| Browse for Computers, Folders, Files and Printers (0) | 2007/09/10 |
| How to draw Transparent Text on bitmap (0) | 2007/09/01 |
| How Do I Remove The Application Icon From The Taskbar? (0) | 2007/08/25 |
| How To Show The Print Dialog And Print Text Files (0) | 2007/08/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 04:40
moneyideas
-
Subject different money making ideas
2010/01/29 13:32
moneyideas
-
Subject different money making ideas
2010/01/31 16:38
moneyideas

Prev

Rss Feed