mattKnight
Programmer
Hi all
I have a service written using ATL3.0 (wizard written code mostly ;-)). I have modified the eventlog code to use message dlls etc.
I have added a simple ATL object to this code and added the following to that declaration:
DECLARE_CLASSFACTORY_SINGLETON(CStates)
CStates has interface IStates
and dispinterface _IStatesEvents
All appears ok, apart from the closing entry in eventlog.
it appears that the CServiceModule destructor fires (before the call to the eventlog routine. As the destructor deletes the pointer to the event logging class, i would expect all hell to break loose( exceptions everywehere) But it all goes silent (and happy). Currently the code is STA so it shouldn't be a threading problem.
However, the more major issue is:
I have written a VB app to mointor and draw information from the CStates class (instantiated by the service).
so
private withevents obj as servicelib.CStates
form load
set obj = new servicelib.cstates
etc
Why do I get 2 instances of CStates? They are both visible in taskmanager with different PIDS. Using traceing code in the CStates constructor shows two entries and exits!
I thought that was the point of SINGLETONS, that you get one instance however many calls to (implied/explicit) to CreateInstance!
All help greatfull appreciated
Matt
I have a service written using ATL3.0 (wizard written code mostly ;-)). I have modified the eventlog code to use message dlls etc.
I have added a simple ATL object to this code and added the following to that declaration:
DECLARE_CLASSFACTORY_SINGLETON(CStates)
CStates has interface IStates
and dispinterface _IStatesEvents
All appears ok, apart from the closing entry in eventlog.
it appears that the CServiceModule destructor fires (before the call to the eventlog routine. As the destructor deletes the pointer to the event logging class, i would expect all hell to break loose( exceptions everywehere) But it all goes silent (and happy). Currently the code is STA so it shouldn't be a threading problem.
However, the more major issue is:
I have written a VB app to mointor and draw information from the CStates class (instantiated by the service).
so
private withevents obj as servicelib.CStates
form load
set obj = new servicelib.cstates
etc
Why do I get 2 instances of CStates? They are both visible in taskmanager with different PIDS. Using traceing code in the CStates constructor shows two entries and exits!
I thought that was the point of SINGLETONS, that you get one instance however many calls to (implied/explicit) to CreateInstance!
All help greatfull appreciated
Matt