Callbacks into another assembly

  • Thread starter Thread starter David
  • Start date Start date
D

David

Here's my problem. I've created a windows service using the Win32 app
instead of the .NET framework's System.ServiceProcess.ServiceBase and
I'm trying to use the RegisterServiceCtrlHandler win32 API call. It
works just fine when I compile all my code and classes in a normal
executable. However, when I throw it into a class library, it can't
seem to find the control handler function. It seems like it's a problem
with the callback into the external assembly. Any suggestions?

Thanks,
- David Hoyt
 
Hi,

Why not use the tools provided by the framework?

By default a win app generate a message loop, this has no use ( not even
sure if is valid, or what consequences it has) in a windows service
scenario.
Any suggestions?

Yes, create a windows service project

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
 
My post was confusing b/c I accidentally said "app" when I meant "API".
The actual program is a console-style app which doesn't have a message
loop. Windows services do not normally let you pop up dialogs (you can
set the interactive process flag, though), etc., so yes, a message loop
would be useless and that's why I'm not using it. (c: The whole point
of my creating the code was not to create a windows service project.
Anyone else have a response?
 
Hi,


I still have no a clear view of what you want,
Do you have a console project and now want to move it to a window service?

Create a windows service project, move all your code to this new project
(either by "Add an existing Item"/ or by old cut & paste ) , add a Installer
(by right click the design view of the service) and then a setup project to
the solution.


cheers,
 
I appreciate your comments, but I think you still don't understand. I
understand exactly how to create a normal windows service using an
installer project, but I have no desire to do so that way. I wrote my
own code based on the service specifications
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/services.asp)
that installs itself. You can read my article at
http://www.codeproject.com/csharp/HoytSoft_ServiceBase.asp or
http://www.hoytsoft.org/serviceBase.aspx - I know exactly what I'm
talking about when it comes to services. My problem is an advanced
issue with windows services and before an answer is likely to be found,
you must understand the service specification as defined in the
platform SDK or possibly marshalling between the library and
executable. Thank you for your interest, though. (c:
 

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

Back
Top