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

📄 tapi.cs

📁 本人觉得C#的软件是不需要源代码的
💻 CS
字号:
using System;
using System.Runtime.InteropServices;
namespace SmartAnswerCall.处理类
{

    public class TAPI
    {
        public const uint dwMediaMode = 20;
        public const uint HUGE_BUFFER = 0x1000;
        public const uint LINEINITIALIZEEXOPTION_USEEVENT = 2;
        public const uint LINEMEDIAMODE_DATAMODEM = 0x10;
        public const uint LINEMEDIAMODE_INTERACTIVEVOICE = 4;
        public const uint PHONEINITIALIZEEXOPTION_USEEVENT = 2;
        public const uint PHONEPRIVILEGE_MONITOR = 1;
        public const uint PHONEPRIVILEGE_OWNER = 2;
        public const uint TAPI_API_HIGH_VERSION = 0x20000;

        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneClose(IntPtr hPhone);
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneGetGain(IntPtr hPhone, uint dwHookSwitchDev, ref IntPtr lpdwGain);
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneGetHookSwitch(IntPtr hPhone, ref IntPtr lpdwHookSwitchDevs);
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneGetStatus(IntPtr hPhone, ref LPPHONESTATUS lpPhoneStatus);
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneGetVolume(IntPtr hPhone, uint dwHookSwitchDev, ref IntPtr lpdwVolume);
        [DllImport("coredll.dll")]
        public static extern int phoneInitializeEx(out IntPtr lphPhoneApp, IntPtr hInstance, IntPtr lpfnCallback, string lpszFriendlyAppName, out uint lpdwNumDevs, ref uint lpdwAPIVersion, ref LPPHONEINITIALIZEEXPARAMS lpPhoneInitializeExParams);
        [DllImport("coredll.dll", SetLastError = true)]
        internal static extern uint phoneNegotiateAPIVersion(IntPtr hPhoneApp, uint dwDeviceID, uint dwAPILowVersion, uint dwAPIHighVersion, out IntPtr lpdwAPIVersion, IntPtr lpExtensionID);
        [DllImport("coredll.dll", SetLastError = true)]
        internal static extern uint phoneNegotiateExtVersion(IntPtr hPhoneApp, uint dwDeviceID, IntPtr dwAPIVersion, uint dwExtLowVersion, uint dwExtHighVersion, out IntPtr lpdwExtVersion);
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneOpen(IntPtr hPhoneApp, uint dwDeviceID, out IntPtr phPhone, IntPtr dwAPIVersion, IntPtr dwExtVersion, IntPtr dwCallbackInstance, uint dwPrivilege);
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneSetGain(IntPtr hPhone, uint dwHookSwitchDev, uint dwGain);
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneSetHookSwitch(IntPtr hPhone, uint dwHookSwitchDevs, uint dwHookSwitchMode);
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneSetVolume(IntPtr hPhone, uint dwHookSwitchDev, uint dwVolume);
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern uint phoneShutdown(IntPtr hPhoneApp);

        [StructLayout(LayoutKind.Sequential)]
        public struct LPPHONEINITIALIZEEXPARAMS
        {
            public uint dwTotalSize;
            public uint dwNeededSize;
            public uint dwUsedSize;
            public uint dwOptions;
            public IntPtr hEvent;
            public uint dwCompletionKey;
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct LPPHONESTATUS
        {
            public uint dwTotalSize;
            public uint dwNeededSize;
            public uint dwUsedSize;
            public uint dwStatusFlags;
            public uint dwNumOwners;
            public uint dwNumMonitors;
            public uint dwRingMode;
            public uint dwRingVolume;
            public uint dwHandsetHookSwitchMode;
            public uint dwHandsetVolume;
            public uint dwHandsetGain;
            public uint dwSpeakerHookSwitchMode;
            public uint dwSpeakerVolume;
            public uint dwSpeakerGain;
            public uint dwHeadsetHookSwitchMode;
            public uint dwHeadsetVolume;
            public uint dwHeadsetGain;
            public uint dwDisplaySize;
            public uint dwDisplayOffset;
            public uint dwLampModesSize;
            public uint dwLampModesOffset;
            public uint dwOwnerNameSize;
            public uint dwOwnerNameOffset;
            public uint dwDevSpecificSize;
            public uint dwDevSpecificOffset;
            public uint dwPhoneFeatures;
        }

        public enum PHONEHOOKSWITCHDEV_Cap : uint
        {
            PHONEHOOKSWITCHDEV_HANDSET = 1,
            PHONEHOOKSWITCHDEV_HEADSET = 4,
            PHONEHOOKSWITCHDEV_SPEAKER = 2
        }

        public enum PHONEHOOKSWITCHMODE : uint
        {
            PHONEHOOKSWITCHMODE_MIC = 2,
            PHONEHOOKSWITCHMODE_MICSPEAKER = 8,
            PHONEHOOKSWITCHMODE_ONHOOK = 1,
            PHONEHOOKSWITCHMODE_SPEAKER = 4,
            PHONEHOOKSWITCHMODE_UNKNOWN = 0x10
        }
    }
}

⌨️ 快捷键说明

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