Desktop Functions: Smart Device Functions:
|
Search Results for "wnet" in [All]Constants1: PROPERTYKEY
public static PropertyKey PKEY_WNET_Scope = new PropertyKey(0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000001); // VT_UINT
public static PropertyKey PKEY_WNET_Type = new PropertyKey(0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000002); // VT_UINT
public static PropertyKey PKEY_WNET_DisplayType = new PropertyKey(0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000003); // VT_UINT
public static PropertyKey PKEY_WNET_Usage = new PropertyKey(0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000004); // VT_UINT
public static PropertyKey PKEY_WNET_LocalName = new PropertyKey(0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000005); // VT_LPWSTR
public static PropertyKey PKEY_WNET_RemoteName = new PropertyKey(0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000006); // VT_LPWSTR
public static PropertyKey PKEY_WNET_Comment = new PropertyKey(0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000007); // VT_LPWSTR
public static PropertyKey PKEY_WNET_Provider = new PropertyKey(0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000008); // VT_LPWSTR comdlg322: PrintDlg
Private m_bShowNetwork As Boolean = False 3: PrintDlgEx
Private m_bShowNetwork As Boolean = False rasapi32
public int dwNetworkOutageTime; Structures5: NETRESOURCE Without the Structlayout the WNetAddConnection2 does not work !!! advapi32
static extern int WNetGetUniversalName(
Private Shared Function WNetGetUniversalName(lpLocalPath As String, <MarshalAs(UnmanagedType.U4)> dwInfoLevel As Integer, lpBuffer As IntPtr, <MarshalAs(UnmanagedType.U4)> ByRef lpBufferSize As Integer) As <MarshalAs(UnmanagedType.U4)> Integer
// First, call WNetGetUniversalName to get the size.
int apiRetVal = WNetGetUniversalName(localPath, UNIVERSAL_NAME_INFO_LEVEL, (IntPtr) IntPtr.Size, ref size);
apiRetVal = WNetGetUniversalName(localPath, UNIVERSAL_NAME_INFO_LEVEL, buffer, ref size);
public class WNet
private static extern int WNetGetUniversalNameW(
// First, call WNetGetUniversalName to get the size.
int apiRetVal = WNetGetUniversalNameW(localPath, REMOTE_NAME_INFO_LEVEL, (IntPtr)IntPtr.Size, ref size);
apiRetVal = WNetGetUniversalNameW(localPath, REMOTE_NAME_INFO_LEVEL, buffer, ref size);
<DllImport("mpr.dll", Entrypoint:="WNetGetUniversalName", CharSet:=CharSet.Auto, SetLastError:=False)> _
_error = WNetGetUniversalName(_origpath, REMOTE_NAME_INFO_LEVEL, CType(IntPtr.Size, IntPtr), size)
If _error.Assign(WNetGetUniversalName(_origpath, REMOTE_NAME_INFO_LEVEL, lpBuffer, size)) = NO_ERROR Then
''' DLL Header for the WNetGetUniversalName
<DllImport("mpr.dll", Entrypoint:="WNetGetUniversalName", CharSet:=CharSet.Unicode, SetLastError:=False)> _
Private Shared Function WNetGetUniversalName(ByVal lpLocalPath As String, _
''' Remote Name Info Structure for use with the WNetGetUniveralName API Call mprprivate static extern int WNetAddConnection2( NETRESOURCE lpNetResource, int result = WNetAddConnection2(nr, password, user, (int)ResourceConnection.CONNECT_TEMPORARY);
private static extern int WNetAddConnection3(IntPtr hWndOwner,
Private Shared Function WNetAddConnection3(ByVal hWndOwner As IntPtr, _
WNetAddConnection3(hWnd, ref ConnInf, null, null, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/wnetaddconnection2.asp The WNetAddConnection2 function supersedes the WNetAddConnection function. If you can pass a handle to a window that the provider of network resources can use as an owner window for dialog boxes, call the WNetAddConnection3 function instead.
public static extern int WNetAddConnection2(ref NETRESOURCE netResource,
public static extern int WNetAddConnection2(NETRESOURCE netResource,
// [DllImport("Mpr.dll", EntryPoint="WNetAddConnection2", CallingConvention=CallingConvention.Winapi)]
// private static extern ErrorCodes WNetAddConnection2(NETRESOURCE lpNetResource,ref string lpPassword,ref
public static extern int WNetAddConnection2( [In] NETRESOURCE netResource,
Declare Function WNetAddConnection2 Lib "mpr.dll" (ByRef netResource As _
Declare Function WNetAddConnection2 Lib "mpr.dll" (netResource As _ // int ret = WNetAddConnection2( myNetResource, "username", "password", 0);
int ret = WNetAddConnection2( myNetResource, "password", "username", 0); //by honglinlee
var result = WNetAddConnection2(
WNetCancelConnection2(_networkName, 0, true);
private static extern int WNetAddConnection2(NetResource netResource,
private static extern int WNetCancelConnection2(string name, int flags,
private static extern int WNetAddConnection2(NETRESOURCE lpNetResource, string lpPassword, string lpUsername, int dwFlags);
int result = WNetAddConnection2(myNetResource, password, user, 0);
returnValue = WNetAddConnection2(myResource, password, username, 0)
private static extern int WNetAddConnection3(IntPtr hWndOwner,
Private Shared Function WNetAddConnection3(ByVal hWndOwner As IntPtr, _
WNetAddConnection3(hWnd, ref ConnInf, null, null, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/wnetaddconnection2.asp
static extern int WNetCancelConnection2(string lpName, Int32 dwFlags, bool bForce);
Declare Function WNetCancelConnection2 Lib "mpr.dll" Alias "WNetCancelConnection2A" (ByVal lpName As String, ByVal dwFlags As Integer, ByVal fForce As Integer) As Integer
''' The WNetCancelConnection2 function cancels an existing network connection.
Private Shared Function WNetCancelConnection2(ByVal lpName As String, _
public static extern int WNetCancelConnection2(string lpName, Int32 dwFlags, bool fForce);
int result=WNetCancelConnection2("Y:", CONNECT_UPDATE_PROFILE, true);
static extern int WNetCancelConnection2(string lpName, Int32 dwFlags, bool bForce);
Declare Function WNetCancelConnection2 Lib "mpr.dll" Alias "WNetCancelConnection2A" (ByVal lpName As String, ByVal dwFlags As Long, ByVal fForce As Long) As Long
''' The WNetCancelConnection2 function cancels an existing network connection.
Private Shared Function WNetCancelConnection2(ByVal lpName As String, _
public static extern int WNetCancelConnection2(string lpName, Int32 dwFlags, bool fForce);
int result=WNetCancelConnection2("Y:", CONNECT_UPDATE_PROFILE, true); 13: WNetCloseEnum
public static extern uint WNetCloseEnum(IntPtr hEnum);
Private Shared Function WNetCloseEnum(hEnum As IntPtr) As UInteger 14: WNetEnumResource
public static extern uint WNetEnumResource(IntPtr hEnum, ref int lpcCount, IntPtr lpBuffer, ref uint lpBufferSize);
Public Shared Function WNetEnumResource(hEnum As IntPtr, ByRef lpcCount As Integer, lpBuffer As IntPtr, ByRef lpBufferSize As UInteger) As UInteger
public static extern int WNetEnumResource(
public static extern int WNetOpenEnum(
public static extern int WNetCloseEnum( IntPtr hEnum );
public static void WNETOE(Object o)
iRet =WNetOpenEnum(
iRet =WNetEnumResource( ptrHandle, ref entries, ptrBuffer, ref buffer );
WNETOE(nr);
iRet =WNetCloseEnum( ptrHandle );
WNETOE(null);
Public Function WNetEnumResource(ByVal hEnum As IntPtr, ByRef lpcCount As Integer, ByVal lpBuffer As IntPtr, ByRef lpBufferSize As Integer) As Integer
Public Function WNetOpenEnum(ByVal dwScope As RESOURCE_SCOPE, ByVal dwType As RESOURCE_TYPE, ByVal dwUsage As RESOURCE_USAGE, ByRef lpNetResource As NETRESOURCE, ByRef lphEnum As IntPtr) As Integer
Public Function WNetCloseEnum(ByVal hEnum As IntPtr) As Integer
iRet = WNetOpenEnum(RESOURCE_SCOPE.RESOURCE_REMEMBERED, RESOURCE_TYPE.RESOURCETYPE_ANY, RESOURCE_USAGE.RESOURCEUSAGE_ATTACHED, o, ptrHandle)
iRet = WNetEnumResource(ptrHandle, entries, ptrBuffer, buffer)
iRet = WNetCloseEnum(ptrHandle)
iRet = WNetOpenEnum(RESOURCE_SCOPE.RESOURCE_GLOBALNET, RESOURCE_TYPE.RESOURCETYPE_ANY, RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER, o, ptrHandle)
iRet = WNetEnumResource(ptrHandle, entries, ptrBuffer, buffer)
iRet = WNetCloseEnum(ptrHandle)
Public Function WNETOE(ByRef o As NETRESOURCE, ByRef resourceCollection As List(Of String)) As Boolean
iRet = WNetOpenEnum(RESOURCE_SCOPE.RESOURCE_GLOBALNET, RESOURCE_TYPE.RESOURCETYPE_ANY, RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER, o, ptrHandle)
iRet = WNetEnumResource(ptrHandle, entries, ptrBuffer, buffer)
If Not WNETOE(nr, resourceCollection) Then
iRet = WNetCloseEnum(ptrHandle)
public static extern int WNetGetConnection([MarshalAs(UnmanagedType.LPTStr)] string localName, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder remoteName, ref int length);
Shared Function WNetGetConnection(<MarshalAs(UnmanagedType.LPTStr)> _
Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal localName As String, ByVal remoteName As System.Text.StringBuilder, ByRef length As Integer) As Integer rc = WNetGetConnection("p:", rname, ref bsize);
Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal localName As String, _
WNetGetConnection(Microsoft.VisualBasic.Left(path, 2), UNC, length)
Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" _
Dim err As Integer = WNetGetConnection(theDriveName, uncPathBuf, uncPathBuf.Capacity) 16: WNetGetLastError
static extern TODO WNetGetLastErrorA(ref int lpError,ref string lpErrorBuf,int nErrorBufSize,string lpNameBuf,int nNameBufSize); public static extern uint WNetGetLastError(ref int lpError,StringBuilder lpErrorBuf,int nErrorBufSize,StringBuilder lpNameBuf,int nNameBufSize); Declare Function WNetGetLastError Lib "mpr.dll" Alias "WNetGetLastErrorA" (ByRef lpError As Integer, ByVal lpErrorBuf As String, ByVal nErrorBufSize As Integer, ByVal lpNameBuf As String, ByVal nNameBufSize As Integer) As Integer 17: WNetOpenEnum
public static extern UInt32 WNetOpenEnum(ResourceScope dwScope, ResourceType dwType, ResourceUsage dwUsage, NetResource lpNetResource, ref IntPtr lphEnum);
Public Shared Function WNetOpenEnum(dwScope As ResourceScope, dwType As ResourceType, dwUsage As ResourceUsage, lpNetResource As NetResource, ByRef lphEnum As IntPtr) As UInteger
private static extern int WNetUseConnection
Declare Function WNetUseConnection Lib "mpr.dll" (TODO) As TODO
ThrowIfError(WNetUseConnection(IntPtr.Zero, nr, password, username, 0, null, null, null));
ThrowIfError(WNetUseConnection(IntPtr.Zero, nr, null, null, promptUser ? Connect.INTERACTIVE | Connect.PROMPT : 0, null, null, null)); netapi3219: NetUseAdd You can also use the WNetAddConnection2 and WNetAddConnection3 functions to redirect a local device to a network resource. Connections added by NetUseAdd are not shown in the Explorer. You should use one of the WNetAddConnection methods to make the networkdrive visible in the explorer. 20: NetUseDel You can also use the WNetCancelConnection2 function to terminate a network connection. |