https://github.com/bbigras/go-windows-session-notifications
Receive session notifications on Windows
https://github.com/bbigras/go-windows-session-notifications
Last synced: about 1 year ago
JSON representation
Receive session notifications on Windows
- Host: GitHub
- URL: https://github.com/bbigras/go-windows-session-notifications
- Owner: bbigras
- Created: 2013-10-26T22:41:14.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-04-24T17:58:30.000Z (about 9 years ago)
- Last Synced: 2025-04-11T18:04:08.733Z (about 1 year ago)
- Language: Go
- Size: 5.86 KB
- Stars: 3
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-windows-session-notifications
Receive session change notifications from Windows.
## Sample code
```go
package main
import (
"github.com/brunoqc/go-windows-session-notifications"
"log"
)
func main() {
quit := make(chan int)
changes := make(chan int, 100)
closeChan := make(chan int)
go func() {
for {
select {
case c := <-changes:
switch c {
case session_notifications.WTS_SESSION_LOCK:
log.Println("session locked")
case session_notifications.WTS_SESSION_UNLOCK:
log.Println("session unlocked")
}
close(m.ChanOk)
}
}
}()
session_notifications.Subscribe(changes, closeChan)
// ctrl+c to quit
<-quit
}
```
## Build with
```bash
set CGO_LDFLAGS=-lwtsapi32
# with powershell
$env:CGO_LDFLAGS="-lwtsapi32";
go build
```