Question How do I use the SendInput API from a Windows service?

Cheetah

Well-known member
Joined
Oct 12, 2006
Messages
232
Programming Experience
Beginner
Hi there,

I am creating a windows service which uses the SendInput API to send keypresses to an application (must be SendInput, SendKeys doesn't work).

For some reason it does not work in a windows service, but the exact same code works flawlessly in a windows form.

I'm guessing there is some sort of extra variable i have to add to get it to work?

Any ideas?

Thanks.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,604
Location
Norway
Programming Experience
10+
Windows services does not live in the desktop world and is protected against it, you can however disable this and check "interact with desktop". Perhaps you can interact with desktop then.
 

Cheetah

Well-known member
Joined
Oct 12, 2006
Messages
232
Programming Experience
Beginner
Tried this to no avaial.

Thanks anyways - looks like ima have to create a windows application and hide the form.
 
Top Bottom