Alternative to Sendkeys in VB.net Windows 10

Asked

Viewed 151 times

-1

Does anyone know any alternative way to use Sendkeys in Windows 10? I have a program that works perfectly on Windows 7 but doesn’t work on 10 because apparently Microsoft has disabled using Sendkeys on it.

The program is running in front of any other and has several buttons. Each button, when clicked, executes the following code:

    SendKeys.Send("%{TAB}")
    SendKeys.Send("ŷ")

The first line is to give alt+tab and change the focus to the last program used and the second is to send, in the window now in focus, a certain string (in this case, "Ŷ". The other buttons do the same, differing only in the sent string.

Does anyone know any other way that this can be done in Windows 10? Thank you!

  • net-core or net-framework?

  • Is net-framework

  • with msbuild or vs-studio or dotnet (command line)? You’re using UAC in the app?

  • I’m using vs-studio. Probably has UAC, I tested it on a newly formatted PC.

  • What does UAC have to do with formatted PC or not? UAC is something else.... UAC has to do with administrative permission.

  • I said it is formatted so you know it is with the default settings. You know of any alternative?

  • UAC has nothing to do with system settings, has to do with the mode the application requires to launch.

  • So I don’t know. How do I check this?

  • Check? What do you mean, the app isn’t yours? Don’t you know what you wrote in it yourself? If you created it then you wrote the UAC part, if you don’t know what it is and you haven’t written anything relative and the program doesn’t require Adm then you haven’t done anything related to it. The sensible answer would be "I don’t know what this is," which would probably sum up that you didn’t program this part, so I’d help you with this.

  • I wrote it years ago and it’s been a long time since I’ve done any programming. I don’t remember setting anything up for that.

  • It’s not a question of "set up" it’s a matter of looking and checking the details, if you didn’t know what UAC was easier to say, after all your questions are devoid of minimal details and I’m trying to help you help yourself, because I’m not able to guess what you’ve done,.

  • Cool, bro. I don’t know what that is.

  • Great, so you didn’t configure it. In your project folder you have a file with the extension .manifest?

  • Yes, it has a .vshost.exe.manifest.

  • Maybe it has generated alone, does not have any with the same name of your project? Or app.manifest?

  • With the exact same name, no. But the project is like Windowsapplication1.exe and has a Windowsapplication1.vshost.exe.manifest. There’s no app manifest..

  • Okay, I’m not sure if this is it, or if it’s from an old version, do the following, in the build of your generated app right click and select start as administrator and see if Sendkeys works ... I believe that it can be this pq in the MSDN has nothing to say about win10 compatibility with Sendkeys, then I don’t know if the information you obtained on the subject is true.

  • In fact, I did some tests here and I saw that Ndkeys is still working, because he kept giving alt tab, just did not send the other key. Then I put a Sleep(200) between the alt tab and the string upload and it’s working perfectly. It seems that the change time between windows is longer, so there was no time for the two commands to be sent in time.

  • It’s very likely even if there was some change in the rendering of Win10 windows.

  • Thank you very much for the provision!

Show 15 more comments

1 answer

1

I was able to solve the problem by placing a delay between a command and another.

SendKeys.Send("%{TAB}")
System.Threading.Thread.Sleep(200)
SendKeys.Send("ŷ")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.