I figured out my problem creating a network connection but now can't seem to disconnect anything I create even though I can go to my computer and see that the drive is physically there and navigate through it.
I keep getting error 2250 ERROR_NOT_CONNECTED.
Here's my disconnect code
WNetCancelConnection is as follows:
If I try to pass the lpName ByVal I get a P/Invoke stack error.
Any thoughts are much appreciated.
----------
Sam
"Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest."
- Isaac Asimov
I keep getting error 2250 ERROR_NOT_CONNECTED.
Here's my disconnect code
Code:
Public Function DestroyNetworkConnection() As Long
Dim ErrInfo As Long
Dim strError As New StringBuilder
ErrInfo = WNetCancelConnection2(TEMP_DRIVE, CONNECT_UPDATE_PROFILE, 0)
DestroyNetworkConnection = ErrInfo
End Function
WNetCancelConnection is as follows:
Code:
Public Declare Ansi Function WNetCancelConnection2 Lib "mpr.dll" Alias "WNetCancelConnection2A" ( _
ByRef lpName As String, _
ByVal dwFlags As Integer, _
ByVal fForce As Boolean) _
As Integer
If I try to pass the lpName ByVal I get a P/Invoke stack error.
Any thoughts are much appreciated.
----------
Sam
"Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest."
- Isaac Asimov