Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vista and Restore Network Connections
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Vista and Restore Network Connections
Miscellaneous
Thread ID:
01206325
Message ID:
01206325
Views:
157
I have been using the following code to re-stablish network connections (disks) in XP, Win 2000, Win Server 2003,...

But Starting with Windows Vista looks like Microsoft has altered or removed the DLL's Entry Point, since it now issues the error

"Can not find Entry point in wNetRestoreConnectionW... in th DLL".

Is there an alternate approach I can use to achieve the same results in Vista ?

* --------------------------------------------------------------------------
PROCEDURE GetNetConn && Get Network connection and ESTABLISH it.

* Microsoft explicitly states it may remove WNetConnection from future Windows versions.

lPARAMETERS cDrive
IF OS(6) # '2' && NOT Windows NT, XP, 2000 Platform
RETURN .F.
ENDIF
WAIT 'Establishing Network Connections.....' WINDOW NOWAIT
LOCAL lcUnicodeDrive, llOK, lnHWND, lnError
* 1 = Converts single-byte characters in cExpression to double-byte characters
* 5 = Converts double-byte characters to UNICODE (wide characters).
lcUnicodeDrive = STRCONV(STRCONV(m.cDrive + CHR(0), 1), 5)
DECLARE Long WNetRestoreConnectionW IN MPR.DLL LONG hWndParent, String lpDevice
lnHWND = _Screen.HWnd

* if the Drive Letter has not been Mapped, it just returns .T. and does not make a fuss
* Only Drive letters that have been used are tried. WHich is GREAT.
lnError = WNetRestoreConnectionW ( m.lnHWND, m.lcUnicodeDrive )
llOK = IIF(m.lnError == 0, .T., .F.)
WAIT CLEAR
RETURN m.llOK
* --------------------------------------------------------------------
Cyrus Nima
-------------------
cyrusnima@gmail.com
Next
Reply
Map
View

Click here to load this message in the networking platform