AlexeiScherbakov / osklib

Library for controlling Windows On Screen Keyboard
MIT License
43 stars 13 forks source link

Requires elevation #10

Open Macaret opened 4 years ago

Macaret commented 4 years ago

I did integrate the Nuget library and added the show keyboard command to a button click:

OnScreenKeyboard.Show();

Error: System.ComponentModel.Win32Exception: 'The requested operation requires elevation.'

I know that the issue may not be with the library, but is there something I can try to make it work?

flier268 commented 2 years ago

Maybe need to add this line to ProcessStartInfo

psi.Verb = "runas";
flier268 commented 2 years ago

@AlexeiScherbakov Will you update this project?

jakob-ledermann commented 1 year ago

I don't think runas is applicable in all situations. Plus somehow for me it does work within a project with <TargetFramework>net461</TargetFramework> and does require the elevation in another project with <TargetFramework>net5.0-windows</TargetFramework>.

Both projects are using Version 1.6.0 of the library.

If I try to launch the same process manually, I still get the same exception even with the Verb = "runas" part. So I do not think adding runas is the solution for this problem. It seems to be related to how the dotnet runtime and .Net-Framework launch processes on windows.