Topaz Filer - Email filing software
Windows Service with Dialog Box
Messages   Related Types
This message was discovered on microsoft.public.dotnet.myservices.


Mr Utkal Ranjan
Hi
I want to create a Windows Service, which will open a port on the machine
and will constantly listen to that port. When any data comes to that port
the service should popup a message that there is some data on the port.

So plz help me , how to achive this ...

Mr Utkal Ranjan, New Delhi, India.

Reply to this message...
Vote that this is a GOOD answer...
 
New BootFX DBGet build available
Twitter and Snow… simple #uksnow
 
    
Elp
Hi,

"Mr Utkal Ranjan" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

It's usally a very bad idea to have any user interface in a Windows Service
(for security reasons, there are plenty of articles about that on the
Microsoft Web Site, on any other Windows server application development web
sites and any good books about server application programming for Windows).
Do you really need that or can you find an other way to do it ?

If you really need that pop-up window, a safe way to do it is to have a
standard windows application (independent from your windows Service)
listenning through .NET remoting for a notification from the windows
service. When some data is available, the service calls a function on the
remote object exposed by the normal application, which in turns displays the
message Box. A bit bulky for such a simple thing but the only safe way to do
it.

If you don't care about security and reliability (i.e. if you just need this
feature for debugging purposes), you can display your message box from the
Windows service. Just tick the box "allow interaction with desktop" in the
Windows Service properties and display your message box from your windows
service. Look in the MessageBox doc, there's a flag called something like
"service message box" i don't remenber the exact name, it maybe allows you
to display a message box in a safe way, i don't know, i never understood the
goal of this flag.

Reply to this message...
Vote that this is a GOOD answer...
 
Windows 7 compatible tool for mounting ISO images
Introduction to BootFX’s Object Relational Mapping Functionality article now live on CodeProject
 
    
Mr Utkal Ranjan
Ya
I want a feature like ANTIVIRUSES. I mean the antivirus program runn as a
service on the machine and when it detects any virus/worm then it popsup a
window displaying the virus info.
Like this i want a service which will listen on a port and when any data
comes to that port i want to display the message(data) to the user.

Thanx

"Elp" <Click here to reveal e-mail address> wrote in message
news:O9Cl#Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Lev Elbert
Antiviruses and like them programs consists of two pieces: service and
agent. Service runs in the background, but agent is a GUI program, which
normally hides its window (sometimes they "live" in the tray). If some event
happens (in your case data arrival), service somehow notifies agent and the
last shows the window.

This is relatively bulky design. The advantage: tray application may be used
to control the service.

The simplest way for you: start a notepad.exe with some file as a parameter
or write a special tiny program and spawn it. This can be done even if your
service is not allowed to communicate with desktop. In C you just call
system() or WinExec() or CreateProcess();

A little bit more complex: use NetMessageBufferSend(); it might work even if
your service is not allowed to communicate with desktop.

In both cases precautions have to be made in the case when nobody is logged
in to this station. By the way, the last method allows to communicate with
remote system(s).

Best regards.

"Mr Utkal Ranjan" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Xenu Link Sleuth
Chromium OS – really?
 
 
System.Windows.Forms.MessageBox




Topaz Filer - Email filing software
Ad
BootFX
Reliable and powerful .NET application framework.
Looking to invest in a major software project? Technical and commercial advice available here.
Other Helpful Sites
MBR 247
Topaz Filer
SharePoint Email Filing
Software Advisory Services
 
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734