Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enable robotgo to support keyboard input control in Windows lock screen state #709

Open
Resulte opened this issue Feb 20, 2025 · 0 comments

Comments

@Resulte
Copy link

Resulte commented Feb 20, 2025

I want to try using RobotGo for keyboard input control in Windows lock screen state, but the actual call fails.
Here is the sample code for my application:

	var err error
	time.Sleep(3 * time.Second)
	err = robotgo.KeyToggle("1")
	err = robotgo.KeyToggle("1", "up")

	time.Sleep(1 * time.Second)
	err = robotgo.KeyToggle("2")
	err = robotgo.KeyToggle("2", "up")

	time.Sleep(1 * time.Second)
	err = robotgo.KeyToggle("3")
	err = robotgo.KeyToggle("3", "up")

	if err != nil {
		fmt.Println(err)
	}

This code runs successfully under normal conditions, but it fails in lock screen state, and the err is still nil.
In lock screen state, I noticed that the internally used SendInput method fails, returning Error code: 5(ERROR_ACCESS_DENIED).
However, even when I run the application with SYSTEM privileges, the same error still occurs.
My testing environment is:

OS: Windows 10
Go version: 1.22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant