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
Why should it be necessary to use NetworkConnect when the drive is already mapped?
Regards Mike
Post your comment on this topic.