Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Universal Naming Convention (UNC) Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
27-Dec-02
Category
Files Operation
Language
Delphi 2.x
Views
51
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Lou Adler

For file-based applications, how is the Universal Naming Convention obtained for 
path names?

Answer:

To get the UNC name of a drive-based path, use the Windows API call 
WNetGetUniversalName. This function takes a drive-based path (i.e., fully qualified 
file name) and returns its UNC equivalent.

Be forewarned, though: This call is not supported by Windows 95. Here's something 
that should work if you're in NT:

1   function GetUNCName(PathStr: string): string;
2   var
3     bufSize: DWord;
4     buf: TUniversalNameInfo;
5     msg: string;
6   begin
7     bufSize := SizeOf(TUniversalNameInfo);
8     if (WNetGetUniversalName(PChar(PathStr), UNIVERSAL_NAME_INFO_LEVEL,
9       buf, bufSize) > 0) then
10      case GetLastError of
11        ERROR_BAD_DEVICE: msg := 'ERROR_BAD_DEVICE';
12        ERROR_CONNECTION_UNAVAIL: msg := 'ERROR_CONNECTION_UNAVAIL';
13        ERROR_EXTENDED_ERROR: msg := 'ERROR_EXTENDED_ERROR';
14        ERROR_MORE_DATA: msg := 'ERROR_MORE_DATA';
15        ERROR_NOT_SUPPORTED: msg := 'ERROR_NOT_SUPPORTED';
16        ERROR_NO_NET_OR_BAD_PATH: msg := 'ERROR_NO_NET_OR_BAD_PATH';
17        ERROR_NO_NETWORK: msg := 'ERROR_NO_NETWORK';
18        ERROR_NOT_CONNECTED: msg := 'ERROR_NOT_CONNECTED';
19      end
20    else
21      msg := buf.lpUniversalName;
22  
23    Result := msg;
24  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC