473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Services and Application.Run

Will Application.Run() work within a service? (e.g. will the message pump be
operational)
My service works as an exe but not a service, i'm wondering it's it's due to
that.

Kind Regards

Simon
Nov 19 '06 #1
5 1278
Simon,

You are sure that your service has not any user interface at all?

Cor

"Simon Tamman" <i_**********************************@NOSPAMhotmai l.com>
schreef in bericht news:0D****************@newsfe1-win.ntli.net...
Will Application.Run() work within a service? (e.g. will the message pump
be
operational)
My service works as an exe but not a service, i'm wondering it's it's due
to
that.

Kind Regards

Simon


Nov 19 '06 #2
There is no UI, it's trying to pick up ALL the keydown events from the
WinAPI via: SetWindowsHookEx in user32.dll.
The application's aim is to just disable the keyboard.
For the API call to work it needs an Application.Run() somewhere to get the
windows message pump running.
In my console app I spawn a thread to hook up the events and then call
Application.Run() that works fine. However, now i've converted it into a
service it no longer works.

Wah.

Any ideas?
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:OP**************@TK2MSFTNGP03.phx.gbl...
Simon,

You are sure that your service has not any user interface at all?

Cor

"Simon Tamman" <i_**********************************@NOSPAMhotmai l.com>
schreef in bericht news:0D****************@newsfe1-win.ntli.net...
Will Application.Run() work within a service? (e.g. will the message
pump
be
operational)
My service works as an exe but not a service, i'm wondering it's it's
due
to
that.

Kind Regards

Simon


Nov 19 '06 #3
"Simon Tamman" <i_**********************************@NOSPAMhotmai l.comwrote in message
news:yY******************@newsfe4-gui.ntli.net...
There is no UI, it's trying to pick up ALL the keydown events from the
WinAPI via: SetWindowsHookEx in user32.dll.
The application's aim is to just disable the keyboard.
For the API call to work it needs an Application.Run() somewhere to get the
windows message pump running.
In my console app I spawn a thread to hook up the events and then call
Application.Run() that works fine. However, now i've converted it into a
service it no longer works.

Wah.

Any ideas?
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:OP**************@TK2MSFTNGP03.phx.gbl...
>Simon,

You are sure that your service has not any user interface at all?

Cor

"Simon Tamman" <i_**********************************@NOSPAMhotmai l.com>
schreef in bericht news:0D****************@newsfe1-win.ntli.net...
Will Application.Run() work within a service? (e.g. will the message
pump
be
operational)
My service works as an exe but not a service, i'm wondering it's it's
due
to
that.

Kind Regards

Simon




Nov 19 '06 #4
"Simon Tamman" <i_**********************************@NOSPAMhotmai l.comwrote in message
news:yY******************@newsfe4-gui.ntli.net...
There is no UI, it's trying to pick up ALL the keydown events from the
WinAPI via: SetWindowsHookEx in user32.dll.
The application's aim is to just disable the keyboard.
For the API call to work it needs an Application.Run() somewhere to get the
windows message pump running.
In my console app I spawn a thread to hook up the events and then call
Application.Run() that works fine. However, now i've converted it into a
service it no longer works.

Wah.

Any ideas?
You are trying to read/process "windows messages", so you effectively have a User Interface.
This is not possible because the service runs in the context of a non-interactive
desktop/winsta,. For a service to run in the same context as an interactive user, you'll
have to set the "interact with desktop" which requires the service to run in the
"localsystem" account. Note that you should only enable this for debugging purposes, and
it's something which won't work on Vista anyway.

Willy.

Nov 19 '06 #5
Thank you very much for your help!
Sure enough setting that checkbox to true allows it to run and receive the
events correctly.

Why should this method of operation be only advisable for debugging, is
there a problem with using it in production?

Kind Regards

Simon

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2********************@TK2MSFTNGP03.phx.gbl.. .
"Simon Tamman" <i_**********************************@NOSPAMhotmai l.com>
wrote in message
news:yY******************@newsfe4-gui.ntli.net...
There is no UI, it's trying to pick up ALL the keydown events from the
WinAPI via: SetWindowsHookEx in user32.dll.
The application's aim is to just disable the keyboard.
For the API call to work it needs an Application.Run() somewhere to get
the
windows message pump running.
In my console app I spawn a thread to hook up the events and then call
Application.Run() that works fine. However, now i've converted it into a
service it no longer works.

Wah.

Any ideas?

You are trying to read/process "windows messages", so you effectively have
a User Interface.
This is not possible because the service runs in the context of a
non-interactive
desktop/winsta,. For a service to run in the same context as an
interactive user, you'll
have to set the "interact with desktop" which requires the service to run
in the
"localsystem" account. Note that you should only enable this for debugging
purposes, and
it's something which won't work on Vista anyway.

Willy.

Nov 20 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Amol Shambharkar | last post by:
Hello Everyone, I am hoping someone could help me out with this.I am using Visual Studio .NET 2003 to create a web application on a remote IIS 5.0 server using the File Share web access method.The...
1
by: Chris Dunaway | last post by:
A quick scan of the group did not immediately reveal an answer to my questions so here goes. First let me describe my app and then I'll ask the questions. I am writing a Windows Forms App (not...
3
by: Peter | last post by:
If I want to build a web services application (not web application), what is the hardware requirement ? Does anyone have the experience?
0
by: Diego F. | last post by:
I've been days with that. I'm trying to work with web services sending and returning objects, and the web service must store some objects. - My first try (the most obvious in my opinion) was to use...
4
by: Greg | last post by:
Hi, I am developing Pocket PC application in VB.NET. Within the application we are using web services developed by outsourced team. They developed the services in C#. After adding a web...
7
by: Magdelin | last post by:
Hi, My security team thinks allowing communication between the two IIS instances leads to severe security risks. Basically, we want to put our presentation tier on the perimeter network and the...
2
by: ken | last post by:
We have a user that has reported the following error when starting up our client application that uses a web service on our back end: System.Configuration.ConfigurationException: Missing required...
5
by: =?Utf-8?B?dmlzaHJ1dGg=?= | last post by:
This code works fine in Windows Application. In Windows Application, I am able to zip the image files properly and it totally contains 900MB My problem is the same code which I used in my Windows...
3
by: Sylvie | last post by:
My Windows Application has two forms, one form contains a grid (lets say Stock Listing), and the other is a form of one stock, contains some edit boxes for one stock's fields.. Is it possible to...
3
by: Marco Pais | last post by:
Hi there. I am developing a client-server application using C# and SQL Server 2005. Right now, I am using web services to access database, but I'm wondering if this is the best way. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.