• 大小: 158KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-14
  • 语言: C#
  • 标签: C#  主板  蜂鸣器  Win7  x64  

资源简介

C#调用主板蜂鸣器发声,Win7x64可用! 编译时请用X86并允许不安全代码。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace Beep
{
    unsafe class BeepManager
    {
        [DllImport(“inpout32.dll“)]
        extern static void Out32(short PortAddress short Data);
        [DllImport(“inpout32.dll“)]
        extern static char Inp32(short PortAddress);

        public void BeepWarn()
        {
            Beep(1140 200);
            System.Threading.Thread.Sleep(200);
            Beep(1140 100);
            System.Threading.Thread.Sleep(100);
            Beep(1140 100);
        }

        public void BeepCall()
        {
            for (int i = 0; i < 20; i++)
            {
                Beep(1140 50);
                System.Threading.Thread.Sleep(50);
            }
        }

        public void Beep(int ms)
        {
            Beep(1140 ms);
        }

        public void Beep(uint freq int ms)
        {
            Out32(0x43 0xB6);
            Out32(0x42 (Byte)(freq & 0xFF));
            Out32(0x42 (Byte)(freq >> 9));
            System.Threading.Thread.Sleep(10);
            Out32(0x61 (Byte)(System.Convert.ToByte(Inp32(0x61)) | 0x03));
            System.Threading.Thread.Sleep(ms);
            StopBeep();
        }

        /**
         * Method to call the stop of the buzzer!!
         */
        private void StopBeep()
        {
            Out32(0x61 (Byte)(System.Convert.ToByte(Inp32(0x61)) & 0xFC));
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     39936  2017-03-11 16:27  Beep\Beep\.vs\Beep\v14\.suo

     文件       1548  2017-03-11 16:23  Beep\Beep\Beep.cs

     文件       4500  2017-03-11 16:27  Beep\Beep\Beep.csproj

     文件       1328  2017-03-11 16:23  Beep\Beep\Beep.sln

     文件       8704  2017-03-11 16:27  Beep\Beep\bin\Debug\Beep.exe

     文件      22016  2017-03-11 16:27  Beep\Beep\bin\Debug\Beep.pdb

     文件      21688  2017-03-11 16:27  Beep\Beep\bin\Debug\Beep.vshost.exe

     文件        490  2012-06-06 02:06  Beep\Beep\bin\Debug\Beep.vshost.exe.manifest

     文件      98304  2011-01-20 01:07  Beep\Beep\bin\Debug\inpout32.dll

     文件      98304  2011-01-20 01:07  Beep\Beep\bin\Release\inpout32.dll

     文件        596  2017-03-11 16:23  Beep\Beep\frmBeep.cs

     文件       2143  2017-03-11 16:23  Beep\Beep\frmBeep.designer.cs

     文件       5817  2017-03-11 16:20  Beep\Beep\frmBeep.resx

     文件        790  2017-03-11 16:19  Beep\Beep\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6097  2017-03-11 16:22  Beep\Beep\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        792  2017-03-11 16:27  Beep\Beep\obj\x86\Debug\Beep.csproj.FileListAbsolute.txt

     文件        849  2017-03-11 16:23  Beep\Beep\obj\x86\Debug\Beep.csproj.GenerateResource.Cache

     文件       1340  2017-03-11 16:23  Beep\Beep\obj\x86\Debug\Beep.csprojResolveAssemblyReference.cache

     文件       8704  2017-03-11 16:27  Beep\Beep\obj\x86\Debug\Beep.exe

     文件        180  2017-03-11 16:27  Beep\Beep\obj\x86\Debug\Beep.frmBeep.resources

     文件      22016  2017-03-11 16:27  Beep\Beep\obj\x86\Debug\Beep.pdb

     文件        180  2017-03-11 16:27  Beep\Beep\obj\x86\Debug\Beep.Properties.Resources.resources

     文件       6100  2017-03-11 16:26  Beep\Beep\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        467  2017-03-11 16:24  Beep\Beep\Program.cs

     文件       1334  2017-03-11 16:19  Beep\Beep\Properties\AssemblyInfo.cs

     文件       2821  2017-03-11 16:19  Beep\Beep\Properties\Resources.Designer.cs

     文件       5612  2017-03-11 16:19  Beep\Beep\Properties\Resources.resx

     文件       1091  2017-03-11 16:19  Beep\Beep\Properties\Settings.Designer.cs

     文件        249  2017-03-11 16:19  Beep\Beep\Properties\Settings.settings

     文件      98304  2011-01-20 01:07  Beep\inpout32.dll

............此处省略20个文件信息

评论

共有 条评论