Using network paths

Created by Mark Crichton, Modified on Fri, 17 Jan at 1:59 PM by Mike James

Use in Windows Vista (and later)
In Windows Vista (and later), when the application is started in “Administrator” mode, the network connections may be lost for the application. If UAC system is enabled, the network drives are disconnected when the user privileges are increased. To be able to use the drives, you must reconnect them with NetworkConnect.

Code which now works as expected:
// Added networkconnect
ResConnect is int = NetworkConnect(“V:”, \\MikeJames2dde\datacom)
// Local drive, correct string content is always returned
//sCSVFile is string ANSi = “C:\Clients\BS Customised GL_2021-11-30.csv”
// UNC reference, correct string content is always returned
//sCSVFile is string ANSi = \\MikeJames2dde\datacom\Blackstone\BS Customised GL_2021-11-30.csv
// Existing mapped (V) drive, correct string content is only returned if networkconnect() is used, otherwise returns nothing
sCSVFile is string ANSi = “V:\Blackstone\BS Customised GL_2021-11-30.csv”
sCSVContent is string = fLoadText(sCSVFile,foansi)
// (Optional) Added a disconnect (network remains connected if this is omitted)
NetworkDisconnect(“V:”)
return sCSVContent

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article