Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
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...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
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...
 
Outlook interop - stopping user properties appearing on Outlook message print
Seriously, why is “cut and paste” majorly newsworthy???
 
    
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...
 
Email Archiving and Email Filing - what’s the difference?
Web-based task/todo list management
 
 
System.Windows.Forms.MessageBox




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734