beep.go 477 B

12345678910111213141516171819202122
  1. // Copyright 2012 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build windows
  5. package main
  6. import (
  7. "syscall"
  8. )
  9. // BUG(brainman): MessageBeep Windows api is broken on Windows 7,
  10. // so this example does not beep when runs as service on Windows 7.
  11. var (
  12. beepFunc = syscall.MustLoadDLL("user32.dll").MustFindProc("MessageBeep")
  13. )
  14. func beep() {
  15. beepFunc.Call(0xffffffff)
  16. }