1.无人地磅具有语音提示的功能,所以需要根据时间段设置电脑音量大小
2.user32.dll从网上下载下来后需要放入根目录
3.
[DllImport("user32.dll")] public static extern IntPtr SendMessageW(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); public void SetVol() { p = Process.GetCurrentProcess(); for (int i = 0; i < 50; i++) { SendMessageW(p.Handle, WM_APPCOMMAND, p.Handle, (IntPtr)APPCOMMAND_VOLUME_DOWN); } for (int i = 0; i <25; i++) { SendMessageW(p.Handle, WM_APPCOMMAND, p.Handle, (IntPtr)APPCOMMAND_VOLUME_UP); } } private Process p; private const int APPCOMMAND_VOLUME_MUTE = 0x80000; private const int APPCOMMAND_VOLUME_UP = 0x0a0000; private const int APPCOMMAND_VOLUME_DOWN = 0x090000; private const int WM_APPCOMMAND = 0x319;