Develop Windows Services 
Author Message
 Develop Windows Services

For my project, I need to develop a "windows services" application. When I
went through the web, I find that all the examples are given only in VC++.
But unfortunately, I don't know VC++. So, I am interested to develop in
Visual Basic.

Any body has any idea about developing the "Windows Services" application
using VB? Please send me appropriate links for the technical documents,
sample codes, etc.

Thanks for your help.

Siva



Tue, 07 Sep 2004 19:43:32 GMT  
 Develop Windows Services
Siva,

Sorry to pass on bad news, but I just don't think this is possible. Writing
a Win32 service requires exporting a number of functions from the resulting
EXE file other than WinMain.

The only approach I can think of is to write an EXE application, with no UI,
that is installed in the user's Startup group.

On Win95/98/ME, you can even go a step further and register your app using
the RunServices key under
HKEY_LOCAL_MACHINE\Software\Windows\CurrentVersion. Simply put in an entry
for your app as follows:

    MyService="c:\apppath\myservice.exe"

This will cause the app to startup before a user has logged on. Be careful
not to do any UI stuff until the user has actually logged on. To prevent the
app closing when the user logs off and logs on (as opposed to shuting down),
you will need to call the API RegisterServiceProcess in your app. You can
detect a user logging off by handling the WM_QUERYENDSESSION and
WM_ENDSESSION messages - lParam  is NULL for shutdown, or ENDSESSION_LOGOFF
for log off.

All this stuff is documented in MSDN.

HTH

Rob


Quote:
> For my project, I need to develop a "windows services" application. When I
> went through the web, I find that all the examples are given only in VC++.
> But unfortunately, I don't know VC++. So, I am interested to develop in
> Visual Basic.

> Any body has any idea about developing the "Windows Services" application
> using VB? Please send me appropriate links for the technical documents,
> sample codes, etc.

> Thanks for your help.

> Siva



Tue, 07 Sep 2004 23:57:27 GMT  
 Develop Windows Services

Quote:

> For my project, I need to develop a "windows services" application. When I
> went through the web, I find that all the examples are given only in VC++.
> But unfortunately, I don't know VC++. So, I am interested to develop in
> Visual Basic.

> Any body has any idea about developing the "Windows Services" application
> using VB? Please send me appropriate links for the technical documents,
> sample codes, etc.

Microsoft's unsupported ntsrv.ocx is the easy way:

 URL:http://msdn.microsoft.com/library/en-us/dnolectrl/html/msdn_ntsrvocx.asp

 URL:http://support.microsoft.com/default.aspx?scid=kb;;q175948

Make the actual "service" as small as possible and break the "real"
functionality and any controlling GUI out into separate components.
That way, the "service" won't ever crash or hang, but if the "real"
workhorse ever does, the "service" can just restart it.

--
Joe Foster <mailto:jlfoster%40znet.com>  Wanna buy a Bridge? <http://xenu.net/>
WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!



Sat, 11 Sep 2004 07:04:17 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Can I use VB6 to develop a service for Windows NT

2. Developing a Windows NT service

3. Service description for Windows Service

4. Windows Service in VB.NET - Failed to process service command

5. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

6. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

7. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

8. On-line Consult-ing Services for Soft-ware Develop-ment

9. Developing a Win 2k (web) service with VB 6.0

10. developing a app to run as a service

11. Develop Own Trigger Service

12. Can I develop a NT service with VB ?

 

 
Powered by phpBB® Forum Software