Desktop Functions: Smart Device Functions:
|
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++; 2: WlanConnect
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 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)
public static extern uint WlanDisconnect(IntPtr hClientHandle,ref Guid pInterfaceGuid,IntPtr pReserved);
Declare Function WlanDisconnect Lib "wlanapi.dll" (TODO) As TODO
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
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/
/// 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); rasapi328: RasDial 9: RasDialDlg
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)
static extern uint RasGetConnectionStatistics(IntPtr hRasConn, ref RAS_STATS lpStatistics);
Public Shared Function RasGetConnectionStatistics( _
uint retVal = RasGetConnectionStatistics(rasConnectionHandle, ref statistics);
public static extern int RasGetConnectStatus(int hrasconn, ref RASCONNSTATUS lprasconnstatus);
Declare Function RasGetConnectStatus Lib "rasapi32.dll" (TODO) As TODO 14: RasHangUp
/// 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); coredll16: CeRunAppAtEvent
NOTIFICATION_EVENT_RS232_DETECTED is also raised when connecting the device to USB.
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;
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; }
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); 20: RasHangUp 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); winspool21: AddPrinter
internal static extern bool AddPrinterConnection(String pszBuffer);
Declare Function AddPrinterConnection Lib "winspool.dll" (TODO) As TODO
internal static extern bool AddPrinterConnection(String pszBuffer);
Declare Function AddPrinterConnection Lib "winspool.dll" (TODO) As TODO 23: ClosePrinter 24: DeletePrinter
internal static extern bool DeletePrinterConnection(String pName);
Declare Function DeletePrinterConnection Lib "winspool.dll" (TODO) As TODO result = DeletePrinterConnection("\\\\Server_Name\\Printer_Share"); setupapi26: Option Explicit MsgBox “Device not connected” netapi3227: NetFileClose
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. 29: NetServerGetInfo
public int AutoDisconnectMinutes; 30: NetSessionDel
''' <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> 31: NetSessionEnum
/// Unable to contact resource. Connection timed out.
/// No available network connection to make call. 32: NetUnjoinDomain 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. 33: 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. 34: NetUseDel You can also use the WNetCancelConnection2 function to terminate a network connection. 35: NetUseEnum
// 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"; rapi39: CeRegDeleteValue odbc3240: SQLAllocConnect
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."); 41: SQLAllocHandle
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, 42: SQLAllocStmt
static extern short SQLAllocStmt(IntPtr ConnectionHandle, out IntPtr StatementHandle);
Private Shared Function SQLAllocStmt(ByVal connectionHandle As IntPtr, <Runtime.InteropServices.Out()> _ 43: SQLBindCol
//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); 44: SQLBrowseConnect
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 45: SQLConnect
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); 46: SQLDataSources
Private Sub OnGetODBCConnectionNames(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbExpSID.DropDown, cmbImpSid.DropDown 47: SQLDisconnect
public static extern short SQLDisconnect(IntPtr ConnectionHandle);
Declare Function SQLDisconnect Lib "odbc32.dll" ( _
connectionHandle As Integer) As Short See SQLDriverConnect. 48: SQLDriverConnect
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; 49: SQLError
IntPtr ConnectionHandle, See SQLDriverConnect example. 50: SQLFreeConnect 51: SQLFreeEnv See SQLDriverConnect example. 52: SQLFreeHandle 53: SQLTables
if (!isOK(SQLAllocStmt(connectionHandle, out statementHandle))) winmm54: midiConnect
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); 55: midiDisconnect
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); winscard56: SCardConnect
[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 57: SCardDisconnect
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); 59: SCardGetAttrib
IntPtr hCard, // Reference value returned from SCardConnect
// Copy code to connect to the card here 60: SCardStatus Cut off search results after 60. Please refine your search. |