windows service : allow service to interact with desktop & SendKeys.SendWait ?

S

Sagaert Johan

Hi

I discovered i must set the 'allow service to interact with desktop'
checkbox on a windows service using the SendKeys.SendWait method.
(otherwise sendwait does not work.)



-Question: i have an installer class, but i don't know how to set the 'allow
service to interact with desktop' option from within my installer.


Johan
 
F

Family Tree Mike

Sagaert Johan said:
Hi

I discovered i must set the 'allow service to interact with desktop'
checkbox on a windows service using the SendKeys.SendWait method.
(otherwise sendwait does not work.)



-Question: i have an installer class, but i don't know how to set the
'allow service to interact with desktop' option from within my
installer.


Johan


Someone will probably state this more elegantly than me...

If your service needs to interact with the desktop, and yours must if it is
interacting with another running application through sendkeys, then you
should not be using a service. What you want to do is prohibited in Vista.
Your design seems more suited to a startup application for each user, as
that scenario will have desktop interaction being allowed.
 
S

Sagaert Johan

in my service i use a barcodereader connected to the comport and then
sendkeys sends the scanned barcode to the active application.

- why is this prohibited in vista ? i see that services under vista also
have the allow interaction with desktop checkbox.

Johan
 
F

Family Tree Mike

Sagaert Johan said:
in my service i use a barcodereader connected to the comport and then
sendkeys sends the scanned barcode to the active application.

- why is this prohibited in vista ? i see that services under vista also
have the allow interaction with desktop checkbox.


Your active application will be running in a different session than the
service. You can search for "Level 0 Isolation" or "Session 0 Isolation" to
understand this better.
 
S

Sagaert Johan

So i better create a standard exe application instead of a windows service ?
 
F

Family Tree Mike

Sagaert Johan said:
So i better create a standard exe application instead of a windows service
?


Family Tree Mike said:
Your active application will be running in a different session than the
service. You can search for "Level 0 Isolation" or "Session 0 Isolation"
to understand this better.


Yes, unless you control the code to the application which needs the barcode
info. If that were the case, you could read directly from that application.
It sounds like that is not doable however.
 
C

Chris Dunaway

in my service i use a barcodereader connected to the comport and then
sendkeys sends the scanned barcode to the active application.

I don't know how your barcode reader works, but there is a feature in
Windows called SerialKeys. It is accessed through Control Panel >
Accessibility Option > General Tab

There is a checkbox called Use SerialKeys and a settings button for
setting the COM port and its settings. Using this feature, data that
comes in on the comport will be seen by the application as
keystrokes. Be sure to check the appropriate options under
"Administrative Options" if you wish the SerialKeys functionality to
remain after a reboot, otherwise it only lasts for the current
session. I'm not sure if this will work with your barcode scanner,
but we have used it successfully with a RF reader attached to a COM
port.

If this works, you may not need a service after all.

Here is information on Session 0 Isolation:

http://www.microsoft.com/whdc/system/vista/services.mspx

Chris
 
S

Sagaert Johan

Hi

Good try, but here it does not work, i just get garbage when i scan a code
(baud rate is correct ) it yieds good data when using with hyperterminal so
i suspect the serial data is bound to some kind of protocol. my barcode
reader outputs plain ascii.(9600 8N1)

Johan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top