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]

wlanapi

.

        byte *connectionData = null;

.

        uint sizeConnectionData = 0;

.

        UInt32 result = EapHostPeerInvokeConfigUI(handle, 0, method, 0, null, &sizeConnectionData, &connectionData, ref er);

.

        MessageBox.Show(sizeConnectionData+"jfdgkj");

.

        output = new byte[sizeConnectionData];

.

        for (int i = 0; i < sizeConnectionData; i++)

.

            output[i] = *connectionData;

.

            //MessageBox.Show(*connectionData+" value"+i);

.

            connectionData++;

.

public static extern uint WlanConnect(IntPtr hClientHandle,ref Guid pInterfaceGuid,ref WLAN_CONNECTION_PARAMETERS pConnectionParameters,IntPtr pReserved);

.

Declare Function WlanConnect Lib "wlanapi.dll" (ByVal hClientHandle As IntPtr, _

.

                         ByRef pConnectionParameters As WLAN_CONNECTION_PARAMETERS, _

.

WLAN_CONNECTION_PARAMETERS

.

WLAN_CONNECTION_PARAMETERS wlanConnectionParameters = new WLAN_CONNECTION_PARAMETERS();

.

wlanConnectionParameters.dot11BssType = DOT11_BSS_TYPE.dot11_BSS_type_any;

.

wlanConnectionParameters.dwFlags = 0;

.

wlanConnectionParameters.strProfile = "dlink";

.

wlanConnectionParameters.wlanConnectionMode = WLAN_CONNECTION_MODE.wlan_connection_mode_profile;

.

WlanConnect(ClientHandle,ref pInterfaceGuid,ref wlanConnectionParameters ,new IntPtr());

.

Dim wlanConnectionParameters As New WLAN_CONNECTION_PARAMETERS

.

wlanConnectionParameters.dot11BssType = DOT11_BSS_TYPE.dot11_BSS_type_any

.

wlanConnectionParameters.dwFlags = 0

.

wlanConnectionParameters.strProfile = "dlink"

.

wlanConnectionParameters.wlanConnectionMode = WLAN_CONNECTION_MODE.wlan_connection_mode_profile

.

WlanConnect(ClientHandle, pInterfaceGuid, wlanConnectionParameters, IntPtr.Zero)

.
Documentation
[WlanConnect] on MSDN
.

public static extern uint  WlanDisconnect(IntPtr hClientHandle,ref Guid pInterfaceGuid,IntPtr pReserved);

.

Declare Function WlanDisconnect Lib "wlanapi.dll" (TODO) As TODO

.
Documentation
[WlanDisconnect] on MSDN
.

WLAN_CONNECTION_ATTRIBUTES

.

        WLAN_CONNECTION_ATTRIBUTES connection;

.

            if (WlanQueryInterface(handle, ref guid, WLAN_INTF_OPCODE.wlan_intf_opcode_current_connection, IntPtr.Zero, out dataSize, ref ptr, IntPtr.Zero) != 0)

.

            connection = (WLAN_CONNECTION_ATTRIBUTES)Marshal.PtrToStructure(ptr, typeof(WLAN_CONNECTION_ATTRIBUTES));

.

            // Do something here with the connection info....    

.

     Dim connection As WLAN_CONNECTION_ATTRIBUTES

.

         If WlanQueryInterface(handle, guid, WLAN_INTF_OPCODE.wlan_intf_opcode_current_connection, IntPtr.Zero, dataSize, ptr, _

.

         connection = DirectCast(Marshal.PtrToStructure(ptr, GetType(WLAN_CONNECTION_ATTRIBUTES)), WLAN_CONNECTION_ATTRIBUTES)

.

         ' Do something here with the connection info....

kernel32

.
Summary
.

static extern bool ConnectNamedPipe(IntPtr hNamedPipe,

.

Good example of named pipes using ConnectNamedPipe() can be found at http://wyday.com/blog/2010/multi-process-c-sharp-application-like-google-chrome-using-named-pipes/

.
Documentation
[ConnectNamedPipe] on MSDN
.

    ///         2. Call Listen().  This will block until a client connects.  Sorry, the alternatives

.

    ///         3. Call DataAvailable() in a loop with Read(), Write, ReadLine(), etc. until IsConnected turns false.

.

    private static extern bool DisconnectNamedPipe(

.

    private static extern bool ConnectNamedPipe(

.

    /// Waits indefinitely when connecting to a pipe.

.

    private const ulong ERROR_PIPE_CONNECTED = 535;

.

    /// Server only: block until client connects

.

        DisconnectNamedPipe(_handle);

.

        if (ConnectNamedPipe(_handle, IntPtr.Zero) != true)

.

        if (lastErr == ERROR_PIPE_CONNECTED)

.

    /// Server only: disconnect the pipe.  For most applications, you should just call Listen()

.

    /// instead, which automatically does a disconnect of any old connection.

.

    public void Disconnect()

.

        throw new Exception("Disconnect() is only for server-side streams");

.

        DisconnectNamedPipe(_handle);

.

    /// Returns true if client is connected.  Should only be called after Listen() succeeds.

.

    public bool IsConnected

.

            throw new Exception("IsConnected() is only for server-side streams");

.

        if (ConnectNamedPipe(_handle, IntPtr.Zero) == false)

.

            if ((uint)Marshal.GetLastWin32Error() == ERROR_PIPE_CONNECTED)

.

            } while (stream.IsConnected);

.
Summary
.

static extern bool DisconnectNamedPipe(IntPtr hNamedPipe);

.
Documentation
[DisconnectNamedPipe] on MSDN

rasapi32

.
Summary
The RasDialDlg function establishes a RAS connection using a specified phone-book entry and the credentials of the logged-on user. The function displays a stream of dialog boxes that indicate the state of the connection operation.
.

bool ret = RAW.RasDialDlg(IntPtr.Zero, "Some Connection Name", IntPtr.Zero, ref info);

.
Summary
The RasDialDlg function establishes a RAS connection using a specified phone-book entry and the credentials of the logged-on user. The function displays a stream of dialog boxes that indicate the state of the connection operation.
.

bool ret = RAW.RasDialDlg(IntPtr.Zero, "Some Connection Name", IntPtr.Zero, ref info);

.

public static extern int RasEnumConnections(

.

    [Out] out int connections);

.

RAW.RASCONN[] connections = new RAW.RASCONN[1];

.

connections[0].dwSize = Marshal.SizeOf(typeof(RAW.RASCONN));

.

int connectionsCount = 0;

.

int nRet = RAW.RasEnumConnections(connections, ref cb, out connectionsCount);

.

if (connectionsCount == 0)

.

connections = new RAW.RASCONN[connectionsCount];

.

for (int i = 0; i < connections.Length; i++)

.

    connections[i].dwSize = Marshal.SizeOf(typeof(RAW.RASCONN));

.

nRet = RAW.RasEnumConnections(connections, ref cb, out connectionsCount);

.

int cb = 0, connectionCount;

.

if (RAW.RasEnumConnections(null, ref cb, out connectionCount) == RAW.ERROR_BUFFER_TOO_SMALL)

.

    if (connectionCount == 0) return;

.

    if (RasApi.RasEnumConnections(buffer, ref cb, out conns) == RAW.ERROR_SUCCESS)

.
Documentation
[RasEnumConnections] on MSDN
.
Summary
Retrieves accumulated connection statistics for a connection
.

static extern uint RasGetConnectionStatistics(IntPtr hRasConn, ref RAS_STATS lpStatistics);

.

Public Shared Function RasGetConnectionStatistics( _

.

uint retVal = RasGetConnectionStatistics(rasConnectionHandle, ref statistics);

.
Documentation
[RasGetConnectionStatistics] on MSDN
.

public static extern int RasGetConnectStatus(int hrasconn, ref RASCONNSTATUS lprasconnstatus);

.

Declare Function RasGetConnectStatus Lib "rasapi32.dll" (TODO) As TODO

.
Documentation
[RasGetConnectStatus] on MSDN
.
Summary
The RasGetEntryDialParams function retrieves the connection information saved by the last successful call to the RasDial or RasSetEntryDialParams function for a specified phone-book entry.
.
Summary
The RasHangUp function terminates a remote access connection. The connection is specified with a RAS connection handle. The function releases all RASAPI32.DLL resources associated with the handle
.
Summary
The RasSetEntryProperties function changes the connection information for an entry in the phone book or creates a new phone-book entry.
.

/// Changes the connection information for an entry in the phone book or creates a new phone-book entry.

.

/// <param name="lpRasEntry">Pointer to the RASENTRY structure that specifies the connection data to associate with the phone-book entry.</param>

.

          public int       dwIdleDisconnectSeconds;

.

        ReconnectIfDropped = 0x100,

.

/// Create or modify network connection.

.

/// <param name="connectionName">Name of the network connection to create or modify.</param>

.

/// <param name="rasEntryStructure">RASENTRY structure containing connection settings.</param>

.

public static RasError SetEntryProperties(string connectionName, RASENTRY rasEntryStructure)

.

     return (RasError)RasSetEntryProperties(null, connectionName, ref rasEntryStructure, Marshal.SizeOf(rasEntryStructure), IntPtr.Zero, 0);

coredll

.
NOTIFICATION_EVENT_RS232_DETECTED When an RS232 connection is made. 9
.

NOTIFICATION_EVENT_RS232_DETECTED is also raised when connecting the device to USB.

.
Summary
Enumerate through the active RAS connections (GPRS, dialup, etc) on Windows Mobile device
.

    private static extern uint RasEnumConnections(

.

        [Out] out int connections);

.

public static RASCONN[] GetAllConnections()

.

        RASCONN[] allConnections = tempConn;

.

        int lpcConnections = 0;

.

        uint ret = RasEnumConnections(tempConn, ref lpcb, out lpcConnections);

.

        // first call returned that there are more than one connections

.

        allConnections = new RASCONN[lpcb / Marshal.SizeOf(typeof(RASCONN))];

.

        allConnections[0] = tempConn[0];

.

        ret = RasEnumConnections(allConnections, ref lpcb, out lpcConnections);

.

        if (lpcConnections > allConnections.Length)

.

        throw new Exception("RAS: error retrieving correct connection count");

.

        else if (lpcConnections == 0)

.

        allConnections = new RASCONN[0];

.

        return allConnections;

.
Documentation
RasEnumConnections @msdn on MSDN
.

    internal static extern UInt32 RasEnumConnections([In, Out] _RASCONN[] lprasconn, ref UInt32 lpcb, ref UInt32 lpcConnections);

.

        public IntPtr ConnectionHandle { get { return m_hrasconn; } }

.

    public static _RASCONN[] EnumerateConnections()

.

        if (RasEnumConnections(rasconn, ref size, ref noelements) != 0x00)

.

            if (RasEnumConnections(rasconn, ref size, ref noelements) != 0x00) { rasconn = null; }

.
Summary
This function retrieves information on the current status of the specified remote access connection
.

public static extern int RasGetConnectStatus(IntPtr hrasconn, ref RASCONNSTATUS lprasconnstatus);

.

        RASCS_ConnectDevice,

.

        RASCS_DeviceConnected,

.

        RASCS_AllDevicesConnected,

.

        RASCS_Connected = RASCS_DONE,

.

        RASCS_Disconnected

.

    public static RASCONNSTATUS GetConnectStatus(IntPtr hrasconn)

.

        RasGetConnectStatus(hrasconn, ref status);

.
Documentation
[RasGetConnectStatus] on MSDN
.
Summary
Disconnect a RAS connection
.

Use this function together with RasEnumConnections, to return a list of the active connections, then the sample code below will loop through the RASCONN[] array and close each one.

.

public static void CloseAllConnections()

.

        RASCONN[] connections = GetAllConnections();

.

        for (int i = 0; i < connections.Length; ++i)

.

        RasHangUp(connections[i].hrasconn);

winspool

.
Summary
.

    internal static extern bool AddPrinterConnection(String pszBuffer);

.

Declare Function AddPrinterConnection Lib "winspool.dll" (TODO) As TODO

.
Documentation
[AddPrinterConnection] on MSDN
.
Summary
.

    internal static extern bool AddPrinterConnection(String pszBuffer);

.

Declare Function AddPrinterConnection Lib "winspool.dll" (TODO) As TODO

.
Documentation
[AddPrinterConnection] on MSDN
.
Summary
Closes a printer connection given a handle
.
Summary
DeletePrinterConnection - disconnect / remove client connection to a shared printer
.

internal static extern bool DeletePrinterConnection(String pName);

.

Declare Function DeletePrinterConnection Lib "winspool.dll" (TODO) As TODO

.

result = DeletePrinterConnection("\\\\Server_Name\\Printer_Share");

.
Documentation
[DeletePrinterConnection] on MSDN

setupapi

.

MsgBox “Device not connected”

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;

credui

.

    credui.pszCaptionText = "Connect to your application";

rapi

.
Summary

odbc32

.
Summary
SQLAllocConnect allocates memory for a connection handle within the environment identified by henv.
.

static extern short SQLAllocConnect(IntPtr EnvironmentHandle, out IntPtr ConnectionHandle);

.

  IntPtr connectionHandle  = IntPtr.Zero;

.

  if (!isOK(SQLAllocConnect(environmentHandle, out connectionHandle)))

.

    throw new Exception("Failed to allocate connection handle.");

.
Documentation
[SQLAllocConnect] on MSDN
.
Summary
SQLAllocHandle allocates an environment, connection, statement, or descriptor handle.
.

    private static extern short SQLBrowseConnect(IntPtr hconn, StringBuilder inString,

.

                if (SQL_NEED_DATA == SQLBrowseConnect(hconn, inString, inStringLength, outString,

.

                    if (SQL_NEED_DATA != SQLBrowseConnect(hconn, inString, inStringLength, outString,

.
Summary
SQLAllocStmt allocates memory for a statement handle and associates the statement handle with the connection specified by hdbc.
.

static extern short SQLAllocStmt(IntPtr ConnectionHandle, out IntPtr StatementHandle);

.

    Private Shared Function SQLAllocStmt(ByVal connectionHandle As IntPtr, <Runtime.InteropServices.Out()> _

.

            //We will use a DSN in our connection string

.

            string connectionString = "DSN=SomeDSN; Uid=myun; Pwd=mypwd;";

.

            //Allocate a database connection handle, using the environment handle we allocated earlier

.

            //Connect to the DB, the completed connection string will be passed back

.

            short retcode = SQLDriverConnect(dbcHandle, IntPtr.Zero, connectionString, 256, completedConnString, 1024, out strLength, SQL_DRIVER_COMPLETE);

.

            //Free resources and disconnect

.

            SQLDisconnect(dbcHandle);

.
Summary
Supports an iterative method of discovering and enumerating the attributes and attribute values required to connect to a data source.
.

  private static extern short SQLBrowseConnect( IntPtr handleConnection, StringBuilder connectionString, short stringLength, StringBuilder outConnection, short bufferLength, out short stringLength2Ptr );

.

Declare Function SQLBrowseConnect Lib "odbc32.dll" (TODO) As TODO

.
Documentation
[SQLBrowseConnect] on MSDN
.

static extern short SQLConnect (int connectionHandle, string serverName,

.

    Private Function SQLConnect(ByVal hDBc As IntPtr, ByVal servername As String, ByVal serverlen As Short, _

.

     RetCode = SQLAllocConnect(hEnv,ref hdbc);

.

     RetCode = SQLConnect(hdbc, "Northwind",-3,null,-3,null,-3);

.
Documentation
[SQLConnect] on MSDN
.

    Private Sub OnGetODBCConnectionNames(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbExpSID.DropDown, cmbImpSid.DropDown

.
Summary
SQLDisconnect closes the connection associated with a specific connection handle.
.

public static extern short  SQLDisconnect(IntPtr ConnectionHandle);

.

Declare Function SQLDisconnect Lib "odbc32.dll" ( _

.

   connectionHandle As Integer) As Short

.

See SQLDriverConnect.

.
Documentation
[SQLDisconnect] on MSDN
.
Summary
SQLDriverConnect is an alternative API to SQLConnect. The difference is that it can popup the dialog to ask the user for more information about the connection
.

    public static extern short SQLDriverConnect(IntPtr  hdbc,

.

    Private Shared Function SQLDriverConnect(ByVal hdbc As IntPtr, ByVal hwnd As IntPtr, ByVal szConnStrIn As String, _

.

    void driverConnect(string connstr, ushort driverCompletion)

.

        const short    MAX_CONNECT_LEN = 1024;

.

        StringBuilder  out_connect = new StringBuilder(MAX_CONNECT_LEN);

.

        string            in_connect  = connstr;

.

        if (!isOK(SQLDriverConnect(connectionHandle,

.

            in_connect,

.

            (short) in_connect.Length,

.

            out_connect,

.

            MAX_CONNECT_LEN,

.

                string msg  = GetError(IntPtr.Zero) + "\nconnection string:\n\t" + connstr;

.

            connectionHandle,

.

            if (!isOK(SQLAllocConnect(environmentHandle, out connectionHandle)))

.

                throw new Exception("Failed to allocate connection handle.");

.

        if (connectionHandle.ToInt32()!=0)

.

            SQLDisconnect(connectionHandle);

.

        if (connectionHandle.ToInt32()!=0)

.

            SQLFreeConnect(connectionHandle);

.

            connectionHandle = IntPtr.Zero;

.
Documentation
[SQLDriverConnect] on MSDN
.

        IntPtr        ConnectionHandle,

.

See SQLDriverConnect example.

.
Summary
SQLFreeConnect releases a connection handle and frees all memory associated with the handle.
.

  static extern short SQLFreeConnect(IntPtr ConnectionHandle);

.

See SQLDriverConnect example.

.
Documentation
[SQLFreeConnect] on MSDN
.

See SQLDriverConnect example.

.
Summary
SQLFreeHandle frees resources associated with a specific environment, connection, statement, or descriptor handle.
.

        if (!isOK(SQLAllocStmt(connectionHandle, out statementHandle)))

winmm

. .
Summary
Connects a MIDI input device to a MIDI thru or output device, or connects a MIDI thru device to a MIDI output device.
.

static extern UInt32 midiConnect(IntPtr hMidi, IntPtr hmo, IntPtr pReserved);

.

Declare Function midiConnect Lib "winmm.dll" (TODO) As TODO

.

UInt32 Connect(IntPtr midiInputHandle, IntPtr midiOutputHandle)

.

     return midiConnect(midiInputHandle, midiOutputHandle, IntPtr.Zero);

.
Documentation
[midiConnect] on MSDN
. .
Summary
Disconnects a MIDI input device from a MIDI thru or output device, or disconnects a MIDI thru device from a MIDI output device.
.

static extern UInt32 midiDisconnect(IntPtr hMidi, IntPtr hmo, IntPtr pReserved);

.

Declare Function midiDisconnect Lib "winmm.dll" (TODO) As TODO

.

UInt32 Disconnect(IntPtr midiInputHandle, IntPtr midiOutputHandle)

.

     return midiDisconnect(midiInputHandle, midiOutputHandle, IntPtr.Zero);

.
Documentation
[midiDisconnect] on MSDN

winscard

. . .
Summary
The SCardConnect function establishes a connection (using a specific resource manager context) between the calling application and a smart card contained by a specific reader. If no card exists in the specified reader, an error is returned.
.

[DllImport("winscard.dll", EntryPoint="SCardConnect", CharSet=CharSet.Auto)]

.

static extern int SCardConnect(

.

rv = SCardConnect(hContext, "Reader X", SCARD_SHARE_SHARED,

.

error CS1502: The best overloaded method match for 'PCSC_ContactlessNet.SmartCard.SCardConnect(System.IntPtr, string, uint, uint, out int, out uint)' has some invalid arguments

.
Documentation
[SCardConnect] on MSDN
. . .
Summary
The SCardDisconnect function terminates a connection previously opened between the calling application and a smart card in the target reader.
.

static extern int SCardDisconnect(int hCard, int dwDisposition);

.
Documentation
[SCardDisconnect] on MSDN
.

    static extern int SCardConnect(IntPtr hContext,

.

    static extern int SCardDisconnect(IntPtr hCard, int Disposition);

.

            result = SCardConnect(hContext, readerName, 2, 3, ref phCard, ref ActiveProtocol);

.

            SCardDisconnect(phCard, 0);

.

   IntPtr hCard,            // Reference value returned from SCardConnect

.

  // Copy code to connect to the card here

.
Summary
The SCardStatus function provides the current status of a smart card in a reader. You can call it any time after a successful call to SCardConnect and before a successful call to SCardDisconnect. It does not affect the state of the reader or reader driver.

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


 
Access PInvoke.net directly from VS: