⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ws2interop.cs

📁 通过手机蓝牙控制个人电脑上的幻灯片的播放
💻 CS
字号:
#region Using directives
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Collections;
#endregion

namespace BTHWrapper
{
    /// <summary>
    /// Summary description for Ws2Interop.
    /// </summary>
    public class Ws2Interop
    {
        [DllImport("bthutil", SetLastError = true)]
        public extern static Int32 BthSetMode(int dwMode);

        [DllImport("bthutil", SetLastError = true)]
        public extern static Int32 BthGetMode(IntPtr pdwMode);

        [DllImport("Ws2_32", SetLastError = true, EntryPoint = "WSAStartup",CharSet = CharSet.Auto)]
        public extern static Int32 WSAStartup([In] short wVersionRequested, [Out] out Ws2Structs.WSAData wsaData);

        [DllImport("Ws2", SetLastError = true)]
        public extern static Int32 WSACleanup();

        [DllImport("ws2", SetLastError = true)]
        public extern static IntPtr socket(int family, int type, int protocol);

        [DllImport("Ws2", SetLastError = true)]
        public extern static int shutdown(IntPtr socket,int how);

        [DllImport("Ws2", SetLastError = true)]
        public extern static int closesocket(IntPtr socket);

        [DllImport("Ws2", SetLastError = true)]
        public extern static int connect(IntPtr socket, ref Ws2Structs.SOCKADDR_BTH address, int addressSize);

        [DllImport("Ws2", SetLastError = true)]
        public extern static int send(IntPtr socket, byte[] buffer, int len, int flags);

        [DllImport("Ws2", SetLastError = true)]
        public extern static int recv(IntPtr socket, byte[] buffer, int len, int flags);

        [DllImport("Ws2", SetLastError = true)]
        public extern static int WSAGetLastError();

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -