Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "connect" in [All]

ole32

.
Summary
Disconnects all remote process connections being maintained on behalf of all the interface pointers that point to a specified object.
.

static extern void CoDisconnectObject(

.
Documentation
[CoDisconnectObject] on MSDN
.

    Connect =   2,

.

    Connect =   2,

winhttp

.

static extern IntPtr WinHttpConnect(IntPtr hSession,

.

Declare Function WinHttpConnect Lib "winhttp.dll" (ByVal hSession As IntPtr, ByVal pswzServerName As String, ByVal nServerPort As Short, ByVal dwReserved As Integer) As IntPtr

.
Documentation
[WinHttpConnect] on MSDN
.
Summary
Retrieve the proxy setting in IE for the current user and the current active connection
.

            IntPtr hConnect,

.

            IntPtr hConnect,

.

Declare Function WinHttpOpenRequest Lib "winhttp.dll" (ByVal hConnect As IntPtr, ByVal pwszVerb As String, ByVal pwszObjectName As String, ByVal pwszVersion As String, ByVal pwszReferrer As String, ByRef ppwszAcceptTypes As Byte(), ByVal dwFlags As Integer) As IntPtr

.

            IntPtr hConnect,

.

Declare Function WinHttpOpenRequest Lib "winhttp.dll" (ByVal hConnect As IntPtr, ByVal pwszVerb As String, ByVal pwszObjectName As String, ByVal pwszVersion As String, ByVal pwszReferrer As String, ByRef ppwszAcceptTypes As Byte(), ByVal dwFlags As Integer) As IntPtr

.

            int dwConnectTimeout,

.

Declare Function WinHttpSetTimeouts Lib "winhttp.dll" (ByVal hInternet As IntPtr, ByVal dwResolveTimeout As Integer, ByVal dwConnectTimeout As Integer, ByVal dwSendTimeout As Integer, ByVal dwReceiveTimeout As Integer) As Boolean

netapi32

.

    if (MessageBox.Show(this, "Are you sure you want to close this connection?" == DialogResult.Yes))

.

    If MsgBox("Are you sure you want to disconnect this resource?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then

.

lpAccount - (in) Pointer to a constant string that specifies an account name to use when connecting to the domain controller. If this parameter is NULL, the caller's context is used.

.

lpPassword - (in) If the lpAccount parameter specifies an account name, this parameter must point to the password to use when connecting to the domain controller. Otherwise, this parameter must be NULL.

.

    public int AutoDisconnectMinutes;

.
Summary
Deletes a network session. A better explanation would be that this api disconnects another computer which is connected to your computer. If the user is copying files then he/she will receive an error. This however does not stop the user from reconnecting.
.

    ''' <param name="UncClientName">[in] Pointer to a string that specifies the computer name of the client to disconnect. If UncClientName is NULL, then all the sessions of the user identified by the username parameter will be deleted on the server specified by servername.</param>

.

        /// Unable to contact resource. Connection timed out.

.

        /// No available network connection to make call.

.

lpAccount - (in) Pointer to a constant string that specifies the account name to use when connecting to the domain controller. The string must specify either a domain NetBIOS name and user account (for example, "REDMOND\user") or the user principal name (UPN) of the user in the form of an Internet-style login name (for example, "someone@example.com"). If this parameter is NULL, the caller's context is used.

.

lpPassword - (in) If the lpAccount parameter specifies an account name, this parameter must point to the password to use when connecting to the domain controller. Otherwise, this parameter must be NULL.

.
Summary
The NetUseAdd function establishes a connection between the local computer and a remote server. You can specify a local drive letter or a printer device to connect. If you do not specify a local drive letter or printer device, the function authenticates the client with the server for future connections.
.

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.

.
Summary
The NetUseDel function ends a connection to a shared resource.
.

You can also use the WNetCancelConnection2 function to terminate a network connection.

.
Summary
NetUseEnum - The NetUseEnum function lists all current connections between the local computer and resources on remote servers.
.

            // now step through all network shares and check if we have already a connection to the server

.

        //  Connection/Session counts

.

        public int Reconnects;

.

        public int CoreConnects;

.

        public int Lanman20Connects;

.

        public int Lanman21Connects;

.

        public int LanmanNtConnects;

.

        public int ServerDisconnects;

user32

.
Summary
.

static extern IntPtr DdeConnect(uint idInst, IntPtr hszService,

.

IntPtr handle = DdeConnect(instanceId, serviceHandle, topicHandle, IntPtr.Zero);

.
Documentation
[DdeConnect] on MSDN
.
Summary
.

static extern IntPtr DdeReconnect(IntPtr hConv);

.
Documentation
[DdeReconnect] on MSDN

printui

.

Add per machine printer connection (the connection will be propagated to the user upon logon):

.

Delete per machine printer connection (the connection will be deleted upon user logon):

wininet

.

hConnect (in) A handle returned from a call to InternetConnect.

.

fExpectResponse (in) A Boolean value that indicates whether the application expects a data connection to be established by the FTP server. This must be set to TRUE if a data connection is expected, or FALSE otherwise.

.

Dim ret As Boolean = FTPCommandA(ConnectionHandle, False, 0, sCommand, IntPtr.Zero, IntPtr.Zero)

.

static extern bool FtpCreateDirectory(IntPtr hConnect, string lpszDirectory);

.

  Private Shared Function FtpCreateDirectory(ByVal hConnect As IntPtr, ByVal lpszDirectory As String) As Boolean

.

static extern bool FtpDeleteFile(IntPtr hConnect, string fileName);

.

   (ByVal hConnect As IntPtr, ByVal fileName As String) _

.

   static extern IntPtr FtpFindFirstFile(IntPtr hConnect,

.

   (ByVal hConnect As IntPtr, ByVal searchFile As String, _

.

static extern bool FtpGetCurrentDirectory(IntPtr hConnect,

.

   (ByVal hConnect As IntPtr, ByVal directory As StringBuilder, ByRef bufferLength As Integer) _

.

' and Me.hINetConn is an IntPtr opened by InternetConnect

.

static extern bool FtpGetFile(IntPtr hConnect, string remoteFile,

.

Declare Function FtpGetFile Lib "wininet.dll" (ByVal hConnect As IntPtr, _

.

    [DllImport("wininet.dll", EntryPoint = "InternetConnectW", CharSet = CharSet.Auto, SetLastError = true)]

.

    private static extern IntPtr InternetConnectW(

.

    public void Connect()

.

        ftpHandle = InternetConnectW(internetHandle, FTPSite,

.

    public void Disconnect()

.

        Connect();

.

        Connect();

.

        Disconnect();

.

static extern bool FtpPutFile(IntPtr hConnect, string lpszLocalFile, string lpszNewRemoteFile, int dwFlags, IntPtr dwContext);

.

Call InternetOpen() and InternetConnect() to get a valid hConnect handle.

.

                (ByVal hConnect As Integer, ByVal lpszExisting As String, _

.

Call InternetOpen() and InternetConnect() to get a valid hConnect handle.

.

static extern bool FtpSetCurrentDirectory(IntPtr hFtpConnection, string lpszDirectory);

.

Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hConnect As IntPtr, ByVal lpszDirectory As String) As Boolean

.

    IntPtr hConnect,

.

  __in  HINTERNET hConnect,

.
Summary
This function attempts to connect to the internet.
.

static extern int InternetAttemptConnect(int dwReserved);

.

Public Declare Function InternetAttemptConnect Lib "wininet" (Optional ByVal dwReserved As Long = 0) As Long

.

If the computer is already connected, the function may hang.

.

  ' This function tries to connect to the internet. If it works, it returns True,

.

  Private Declare Function InternetAttemptConnect Lib "wininet" (Optional ByVal dwReserved As Integer = 0) As Integer

.

  Public Function ConnectToInternet() As Boolean

.

    If InternetAttemptConnect(0) = 0 Then

.
Documentation
[InternetAttemptConnect] on MSDN
.
Summary
Allows an application to check if a connection to the Internet can be established.
.

static extern bool InternetCheckConnection(string lpszUrl, int dwFlags, int dwReserved);

.

Declare Function InternetCheckConnection Lib "wininet.dll" (ByVal lpszUrl As String, ByVal dwFlags As Integer, ByVal dwReserved As Integer) As Boolean

.

private static extern bool InternetCheckConnection(string lpszUrl, int dwFlags, int dwReserved);

.

bool connectivity;

.

if (InternetCheckConnection("http://www.google.com/", 1, 0))

.

     connectivity = true;

.

    * Returns a valid handle to the FTP, Gopher, or HTTP session if the connection is successful, or NULL otherwise. To get extended error information, call GetLastError. An application can also use InternetGetLastResponseInfo to determine why access to the service was denied.

.

static extern IntPtr InternetConnect(

.

Declare Auto Function InternetConnect Lib "wininet.dll" (

.

    Number of the TCP/IP port on the server to connect to. Can be one of the values in the following list. If this parameter is set to INTERNET_INVALID_PORT_NUMBER, the function uses the default port for the specified service. These values do not cause the function to use this protocol. The value sets the port to be used. A flag must be used to set the service.

.

    INTERNET_SERVICE_FTP     INTERNET_CONNECT_FLAG_PASSIVE (Use passive mode in all data connections for this FTP session.)

.

The InternetConnect function is required before communicating with any Internet service.

.

Having a connect function for all protocols, even those that do not use persistent connections, lets an application communicate common information about several requests using a single function call. In addition, this allows for future versions of Internet protocols that do not require a connection to be established for every client request.

.

For FTP sites, InternetConnect actually establishes a connection with the server; for others, such as Gopher, the actual connection is not established until the application requests a specific transaction.

.

For maximum efficiency, applications using the Gopher and HTTP protocols should try to minimize calls to InternetConnect and avoid calling this function for every transaction requested by the user. One way to accomplish this is to keep a small cache of handles returned from InternetConnect; when the user makes a request to a previously accessed server, that session handle is still available.

.

For FTP connections, if lpszUsername is NULL, InternetConnect sends the string "anonymous" as the user name. If lpszPassword is NULL, InternetConnect attempts to use the user's e-mail name as the password.

.

To close the handle returned from InternetConnect, the application should call InternetCloseHandle. This function disconnects the client from the server and frees all resources associated with the connection.

.

private static extern Int32 InternetDial(IntPtr hwndParent, string lpszConnectoid, Int32 dwFlags, ref Int32 lpdwConnection, Int32 dwReserved);

.

int nResult = InternetDial(IntPtr.Zero ,"Your connection",(int)InternetDialFlags.INTERNET_DIAL_UNATTENDED ,ref nConnection , 0);

.

///     Retrieves the connected state of the local system.

.

///     C++ ( lpdwFlags [out]. Type: LPDWORD )<br />Pointer to a variable that receives the connection description. This

.

///         <term>Internet Connection State Possible Flags</term>

.

///         <term>INTERNET_CONNECTION_CONFIGURED (0x40)</term>

.

///         Local system has a valid connection to the Internet, but it might or might not be currently

.

///         connected.

.

///         <term>INTERNET_CONNECTION_LAN (0x02)</term>

.

///         <description>Local system uses a local area network to connect to the Internet.</description>

.

///         <term>INTERNET_CONNECTION_MODEM (0x01)</term>

.

///         <description>Local system uses a modem to connect to the Internet.</description>

.

///         <term>INTERNET_CONNECTION_MODEM_BUSY (0x08)</term>

.

///         <term>INTERNET_CONNECTION_OFFLINE (0x20)</term>

.

///         <term>INTERNET_CONNECTION_PROXY (0x04)</term>

.

///         <description>Local system uses a proxy server to connect to the Internet.</description>

.

///     <c>true</c> if there is an active modem or a LAN Internet connection, <c>false</c> if there is no Internet

.

///     connection, or if all possible Internet connections are not currently active.

.

///     A return value of TRUE from InternetGetConnectedState indicates that at least one connection to the Internet is

.

///     available. It does not guarantee that a connection to a specific host can be established. Applications should

.

///     always check for errors returned from API calls that connect to a server. InternetCheckConnection can be called to

.

///     determine if a connection to a specific destination can be established.

.

///     <br />A return value of TRUE indicates that either the modem connection is active, or a LAN connection is active

.

///     is connected.If FALSE is returned, the INTERNET_CONNECTION_CONFIGURED flag may be set to indicate that autodial is

.

extern static bool InternetGetConnectedState(out int lpdwFlags, int dwReserved);

.

enum ConnectionStates

.

  Private Declare Function InternetGetConnectedState Lib "wininet.dll" _

.

Private Enum ConnectionStates

.

InternetGetConnectedStateFlags

.

   private static extern bool InternetGetConnectedState(out int lpdwFlags, int dwReserved);

.

    bool isConnected = InternetGetConnectedState(out flags, 0);

.

    Console.WriteLine(string.Format("Is connected :{0} Flags:{1}", isConnected, flags));

.

Function Get_InternetConnectedState(ByRef p_lngFlags As Long, Optional ByRef p_return_str As String = "") As Boolean

.

      Get_InternetConnectedState = False

.

      If InternetGetConnectedState(lngFlags, 0) Then

.

     'connected.

.

     If lngFlags And ConnectionStates.LAN Then

.

        'LAN connection.

.

        p_return_str = "LAN connection."

.

     ElseIf lngFlags And ConnectionStates.Modem Then

.

        'Modem connection.

.

        p_return_str = "Modem connection."

.

     ElseIf lngFlags And ConnectionStates.Proxy Then

.

        'Proxy connection.

.

        p_return_str = "Proxy connection."

.

     Get_InternetConnectedState = True

.

     'not connected.

.

     p_return_str = "Not connected."

.

     Get_InternetConnectedState = False

.
Documentation
[InternetGetConnectedState] on MSDN
.

Direct Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetgetconnectedstate.asp

.
Summary
You can use the InternetHangUp function to instruct the modem to end the connection that the Connection parameter specifies.
.

extern static int InternetHangUp(int Connection, int ReservedValue);

.

  sAgent can be any string, it is just to identify the connection

.
Summary
Contains the list of options for a particular Internet connection.
.

    /// Connection name to set/query options

.

    public IntPtr szConnection;

shell32

45: CSIDL
.

            CSIDL_CONNECTIONS           = 0x0031,    // Network and Dial-up Connections

.

        /// The computer has disconnected from a server.

.

        /// <i>dwItem1</i> contains the server from which the computer was disconnected.

.

        SHCNE_SERVERDISCONNECT = 0x00004000,

.

    ' The computer has disconnected from a server.

.

    ' <i>dwItem1</i> contains the server from which the computer was disconnected.

.

    SHCNE_SERVERDISCONNECT = &H4000

.

        SEE_MASK_CONNECTNETDRV = 0x00000080,  

.

            FOF_NO_CONNECTED_ELEMENTS = 0x2000,  // don't operate on connected elements.

.

        public bool FOF_NO_CONNECTED_ELEMENTS = false;

.

                if ( this.FOF_NO_CONNECTED_ELEMENTS )

.

                    ReturnValue |= (ushort)FILEOP_FLAGS_ENUM.FOF_NO_CONNECTED_ELEMENTS;

.

        CSIDL_CONNECTIONS         = 0x0031,    // Network and Dial-up Connections

.

    public static readonly Guid ConnectionsFolder = new Guid( "6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD" );

.

    CONNECTIONS = &H31

.

        CSIDL_CONNECTIONS       = 0x0031,    // Network and Dial-up Connections

.

    public static Guid ConnectionsFolder = new Guid("6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD");

advapi32

.

            throw new Exception(String.Format("Error connecting to Service Control Manager. Error provided was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Error connecting to Service Control Manager. Error provided was: 0x{0:X}", Marshal.GetLastWin32Error()));

.
Summary
If you enable autologon, it is more convenient to use Windows; however this feature may pose a security risk. If you set a computer for autologon, anyone who can physically obtain access to the computer can gain access to all of the computer contents, including any network or networks it is connected to. In addition, when autologon is enabled, the password is stored in the registry in plaintext. The specific registry key that stores this value is remotely readable by the Authenticated Users group. This setting is only recommended for cases where the computer is physically secured, and steps have been taken to ensure that untrusted users cannot remotely access the registry.
.

        SC_MANAGER_CONNECT     = 0x00001,

.

            SC_MANAGER_CONNECT |

.

      private enum ServiceControlManagerType { SC_MANAGER_CONNECT = 0x1, SC_MANAGER_CREATE_SERVICE = 0x2, SC_MANAGER_ENUMERATE_SERVICE = 0x4, SC_MANAGER_LOCK = 0x8, SC_MANAGER_QUERY_LOCK_STATUS = 0x10, SC_MANAGER_MODIFY_BOOT_CONFIG = 0x20, SC_MANAGER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK | SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG }

.

    SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000014,

.

    SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = &H14UI

.

    SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000014,

.

    SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = &H14UI

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: