golang.org/x/sys@v0.20.1-0.20240517151509-673e0f94c16d/windows/svc/example/beep.go (about)

     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  
     5  //go:build windows
     6  
     7  package main
     8  
     9  import (
    10  	"syscall"
    11  )
    12  
    13  // BUG(brainman): MessageBeep Windows api is broken on Windows 7,
    14  // so this example does not beep when runs as service on Windows 7.
    15  
    16  var (
    17  	beepFunc = syscall.MustLoadDLL("user32.dll").MustFindProc("MessageBeep")
    18  )
    19  
    20  func beep() {
    21  	beepFunc.Call(0xffffffff)
    22  }