mediaproxy
asked on
use WNetAddConnection2 and WNetCancelConnection2 in javascript
Can anyone show me how to use WNetAddConnection2 and WNetCancelConnection2 in javascript to connect/disconnect to a remote computer?
Thanks.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi,
I personally never used vbscript that much. Very little knowledge. Let me give you small example.
Also there is very easy tutorial for vbscript in one or two pages, one can learn things.
http://visualbasic.about.com/library/bllvbscriptb.htm
<html>
<head>
<title>Two Button Form</title>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub buttonA_onclick
MsgBox("Button A was clicked")
End Sub
Sub buttonB_onclick
MsgBox("Button B was clicked")
End Sub
-->
</SCRIPT>
</head>
<body>
<INPUT type="button" value="A" id=buttonA name=buttonA>
<INPUT type="button" value="B" id=buttonB name=buttonB>
</body>
</html>
I personally never used vbscript that much. Very little knowledge. Let me give you small example.
Also there is very easy tutorial for vbscript in one or two pages, one can learn things.
http://visualbasic.about.com/library/bllvbscriptb.htm
<html>
<head>
<title>Two Button Form</title>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub buttonA_onclick
MsgBox("Button A was clicked")
End Sub
Sub buttonB_onclick
MsgBox("Button B was clicked")
End Sub
-->
</SCRIPT>
</head>
<body>
<INPUT type="button" value="A" id=buttonA name=buttonA>
<INPUT type="button" value="B" id=buttonB name=buttonB>
</body>
</html>
ASKER
I've tried to put it under the <body> tag but does not work
<script language="vbscript">
Option Explicit
Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, errInfo = WNetAddConnection2(NETR, sPassword, sUser, CONNECT_UPDATE_PROFILE)
..........................
ConnectUserPassword = errInfo = NO_ERROR
End Function
</script>
<script language="vbscript">
msgbox("Connecting...")
Call ConnectUserPassword("\\192
msgbox("Connected")
</script>
The msgbox("connected") line is never executed. This means something went wrong before that line.