Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to identify the server name.
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00817893
Message ID:
00817926
Views:
24
Hi Raymond,

Try this code:
? GetUNC('Z')

FUNCTION GetUNC(cDrvLetter)
#DEFINE DRIVE_REMOTE  4
	DECLARE INTEGER GetDriveType IN kernel32 STRING RootPath

	DECLARE INTEGER WNetGetConnection IN mpr;
		STRING lpLocalName, STRING @lpRemoteName, INTEGER @lpnLen

	LOCAL nDrvType, cUnc, nBufsize, cBuff
	nDrvType = GetDriveType(cDrvLetter + ":\")
	cUnc = ''

	IF nDrvType = DRIVE_REMOTE
		nBufsize = 250
		cBuff = Repli(Chr(0), nBufsize)
		IF WNetGetConnection(cDrvLetter+':', @cBuff, @nBufsize) = 0
			cUnc = LEFT(cBuff, nBufsize)
		ENDIF
	ENDIF
RETURN cUnc
Previous
Reply
Map
View

Click here to load this message in the networking platform