I only receive the kApplicationSuspendMsg (InDesign CS3), what could I be missing?
In the startupshutdown i have:
obsv = (IObserver*) CreateObject (kAppObserverBoss, IID_IOBSERVER);
//attach app messages observer
InterfacePtr<IApplication> iApp (gSession->QueryApplication ());
InterfacePtr<ISubject> iAppSubject (iApp, IID_ISUBJECT);
iAppSubject->AttachObserver(obsv , IID_IAPPLICATION);
and in the update of the appObserver I have:
if( theChange.Get ()== kAppBoss)
As Dirk rightly pointed out, you need to place an observer in the kAppBoss and observe on the IID_IAPPLICATION protocol.
What you should do is just place an interface as an addin in the kAppBoss and give it an implementation (you don't need to create a observer boss class as you have done).
In startup call the autoattach of your observer, for ex
InterfacePtr<IObserver> iMyObserver(app, IID_IMYOBSERVER);
In the autoattach method of your implementation class, remember to pass your observers interface ID to the attachobsever method of the ISubject
AttachObserver(this, IID_IAPPLICATION, IID_IMYPOBSERVER);
Then in the update method you will get properly notified of the suspend and resume of application
This should fix your problem.
- Efficient InDesign Solutions -