473,387 Members | 1,582 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,387 software developers and data experts.

Callbacks into another assembly

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

Nov 17 '05 #1
4 1394
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


"David" <el*******@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com... 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. >
Thanks,
- David Hoyt

Nov 17 '05 #2
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?

Nov 17 '05 #3
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,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"David" <el*******@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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?

Nov 17 '05 #4
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/de...e/services.asp)
that installs itself. You can read my article at
http://www.codeproject.com/csharp/Ho...erviceBase.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:

Nov 17 '05 #5

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

Similar topics

0
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update...
2
by: johny smith | last post by:
I cannot seem to figure out how to do instance based callbacks for some reason. I found one site on functors but I did not find it that helpful actually I just don't understand it. I have no...
5
by: Christopher Jastram | last post by:
I'm a self-taught programmer, so this might be a pretty dumb question. If it is, please point me in the right direction and I shall apologize profusely. I have a question regarding C++ and...
4
by: womanontheinside | last post by:
I have a library which was written in C, you call a function, it provides the result by a callback to specific function names. I am trying to wrap the calls to this inside a class, but this causes...
21
by: Šimon Tóth | last post by:
Hi, i need to use callbacks in C++. I found great article from Rich Hickey, and i'm using his callback.h file in my project. The problem is that when I compile my project I get two pages of...
3
by: David | last post by:
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...
3
by: Tuxpal | last post by:
What are the pros/cons of using Callback mechanism in C? (Design perspective) What are the scenarios where it can be applied ? Tuxpal
1
by: Niklas | last post by:
Hi I have a remoting client/server application. The clients subscribes to a server event. All works fine if client is used as a window application, but when the client is used with No-Touch...
9
by: zholthran | last post by:
Hi folks, after reading several threads on this issue (-> subject) I fear that I got a problem that cannot easily be solved by the offered workarounds in an acceptable way, at least not with my...
7
by: Dave Booker | last post by:
Is it possible to call a .NET 2.0 delegate from an event in a .NET 1.1 process? We have a class compiled with Framework 1.1 that has a public Event called 'Error.' That class is instantiated in a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.