_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Try mapping your PC’s Power button to Hibernate; that should show
you the hibernate event with a minimum of other UnknownEvents. Steve From:
[hidden email] [mailto:[hidden email]] On Behalf Of Joachim
Geidel Hello
everybody, we
have a two-tier application running on Windows clients which is connected
to a database. When Windows switches to hibernation or standby mode, we would
like to react to the Windows message which is sent to all applications, such that
we can shutdown database connections. Does anybody know if this is possible
with VisualWorks? Ideally (i.e. nice-to-have), I would like to be able to
respond to the message to tell Windows whether our application allows the
transition or not. I know that this can be done in general, similarly to the
handling of the WM_QUERYENDSESSION message, but I don't know if the VW VM
supports it. I guessed that the hibernation messages would be wrapped in an
UnknownEvent, but haven't yet been able to identify if the are passed to the
image by the VM, as there is a deluge of UnknownEvents when I just move the
mouse (Vista; I have no idea what these events mean). As
an aside, would that be possible on other platforms, too? Any
ideas are most welcome. Thanks
in advance! Joachim
Geidel _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Dear Joachim,
Your problem is of serious interest to. If you found a solution I would appreciate if you could share some snipets of code. Regards, @Maarten, > Message du 29/03/10 10:59 > De : "Steven Kelly" > A : "Joachim Geidel" , "VWNC" > Copie à : > Objet : Re: [vwnc] Dealing with Hibernation? > > Try mapping your PC’s Power button to Hibernate; that should show you the hibernate event with a minimum of other UnknownEvents. > > Steve > > > > From: [hidden email] [mailto:[hidden email]] On Behalf Of Joachim Geidel > Sent: 29. maaliskuuta 2010 11:24 > To: VWNC > Subject: [vwnc] Dealing with Hibernation? > > > > Hello everybody, > > we have a two-tier application running on Windows clients which is connected to a database. When Windows switches such that we can shutdown database connections. Does anybody know if this is possible with VisualWorks? Ideally (i.e. nice-to-have), I would like to be able to respond to the message to tell Windows whether our application allows the transition or not. I know that this can be done in general, similarly to the handling of the WM_QUERYENDSESSION message, but I don't know if the VW VM supports it. I guessed that the hibernation messages would be wrapped in an UnknownEvent, but haven't yet been able to identify if the are passed to the image by the VM, as there is a deluge of UnknownEvents when I just move the mouse (Vista; I have no idea what these events mean). > > As an aside, would that be possible on other platforms, too? > > Any ideas are most welcome. > > Thanks in advance! > > Joachim Geidel > > > > > > [ (pas de nom de fichier) (0.1 Ko) ] _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Joachim Geidel
Am 29.03.2010 10:24, schrieb Joachim Geidel:
> Hello everybody, > > we have a two-tier application running on Windows clients which is > connected to a database. When Windows switches to hibernation or standby > mode, we would like to react to the Windows message which is sent to all > applications, such that we can shutdown database connections. Does > anybody know if this is possible with VisualWorks? Ideally (i.e. > nice-to-have), I would like to be able to respond to the message to tell > Windows whether our application allows the transition or not. I know > that this can be done in general, similarly to the handling of the > WM_QUERYENDSESSION message, but I don't know if the VW VM supports it. I > guessed that the hibernation messages would be wrapped in an > UnknownEvent, but haven't yet been able to identify if the are passed to > the image by the VM, as there is a deluge of UnknownEvents when I just > move the mouse (Vista; I have no idea what these events mean). for Windows, you could implement something like this: ---- WindowsInputManager>>processHostEvent: aHostEventArray | kind hostEvent parameter | hostEvent := aHostEventArray at: 10. kind := hostEvent longAt: 9. kind = 16r218 ifTrue: [ " WM_POWERBROADCAST " parameter := hostEvent longAt: 13. parameter = 4 ifTrue: [ " PBT_APMSUSPEND " self triggerEvent: #suspendSystem. ]. parameter = 18 ifTrue: [ " PBT_APMRESUMEAUTOMATIC " self triggerEvent: #resumeSystem. ] ]. ---- and then handle the triggered events: InputManager default when: #suspendSystem do: [ Transcript show: 'Suspend';cr ]; when: #resumeSystem do: [ Transcript show: 'Resume';cr ]. note that the event will be triggered for each window _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Am 31.03.2010 15:03, schrieb Holger Kleinsorgen:
> Am 29.03.2010 10:24, schrieb Joachim Geidel: >> Hello everybody, >> >> we have a two-tier application running on Windows clients which is >> connected to a database. When Windows switches to hibernation or standby >> mode, we would like to react to the Windows message which is sent to all >> applications, such that we can shutdown database connections. Does >> .... > > for Windows, you could implement something like this: > > ---- > > WindowsInputManager>>processHostEvent: aHostEventArray > you could also patch ScheduledWindow>>unknownEvent: so that it passes the unknown event when triggering #unknownEvent ScheduledWindow>>unknownEvent: anEvent self triggerEvent: #unknownEvent with: anEvent. ... and then register an event handler at the main window of your application self mainWindow when: #unknownEvent do: [ : eventArray | | hostEvent ... | hostEvent := aHostEventArray at: 10. ... ]. _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Holger Kleinsorgen-4
Thanks a lot! This looks very promising, I'll try that asap. :-)
Joachim Geidel Am 31.03.10 15:03 schrieb Holger Kleinsorgen: > Am 29.03.2010 10:24, schrieb Joachim Geidel: >> Hello everybody, >> >> we have a two-tier application running on Windows clients which is >> connected to a database. When Windows switches to hibernation or standby >> mode, we would like to react to the Windows message which is sent to all >> applications, such that we can shutdown database connections. Does >> anybody know if this is possible with VisualWorks? Ideally (i.e. >> nice-to-have), I would like to be able to respond to the message to tell >> Windows whether our application allows the transition or not. I know >> that this can be done in general, similarly to the handling of the >> WM_QUERYENDSESSION message, but I don't know if the VW VM supports it. I >> guessed that the hibernation messages would be wrapped in an >> UnknownEvent, but haven't yet been able to identify if the are passed to >> the image by the VM, as there is a deluge of UnknownEvents when I just >> move the mouse (Vista; I have no idea what these events mean). > > for Windows, you could implement something like this: > > ---- > > WindowsInputManager>>processHostEvent: aHostEventArray > > | kind hostEvent parameter | > hostEvent := aHostEventArray at: 10. > kind := hostEvent longAt: 9. > kind = 16r218 > ifTrue: > [ " WM_POWERBROADCAST " > parameter := hostEvent longAt: 13. > parameter = 4 > ifTrue: > [ " PBT_APMSUSPEND " > self triggerEvent: #suspendSystem. > ]. > parameter = 18 > ifTrue: > [ " PBT_APMRESUMEAUTOMATIC " > self triggerEvent: #resumeSystem. > ] > ]. > > ---- > > > and then handle the triggered events: > > InputManager default > when: #suspendSystem do: [ Transcript show: 'Suspend';cr ]; > when: #resumeSystem do: [ Transcript show: 'Resume';cr ]. > > note that the event will be triggered for each window > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
FYI:
I've published a small package named "OSProcessSignalHandler" in the public respository. It tries to unify the way various OS signals are handled (signals like SIGTERM sent to the VW process on Unix, console and window events on Windows). Testing and improving the code is welcome ;) ---------------- Package comment: ---------------- OSProcessSignalHandler handles OS signals (interrupt/terminate etc) sent to VisualWorks, and announces them to interested parties. OS specific notes: - On Unix, clients have to provide a list of signal names, or use the predefined signal name lists - On Windows, both console events (Ctrl-C etc.) and events sent to application windows and unknown to the VM are handled. Example: OSProcessSignalHandler current listenToLifecycleSignals; when: OSProcessSignal do: [ : signal | Stdout nextPutAll: signal signalName, ' ' , signal code displayString; cr ]; when: OSProcessCloseSignal do: [ : signal | Stdout nextPutAll: 'Bye bye'; cr. ObjectMemory quit ]; yourself ---------------- Am 31.03.2010 19:46, schrieb Joachim Geidel: > Thanks a lot! This looks very promising, I'll try that asap. :-) > > Joachim Geidel > > Am 31.03.10 15:03 schrieb Holger Kleinsorgen: > >> Am 29.03.2010 10:24, schrieb Joachim Geidel: >>> Hello everybody, >>> >>> we have a two-tier application running on Windows clients which is >>> connected to a database. When Windows switches to hibernation or standby >>> mode, we would like to react to the Windows message which is sent to all >>> applications, such that we can shutdown database connections. Does >>> anybody know if this is possible with VisualWorks? Ideally (i.e. >>> nice-to-have), I would like to be able to respond to the message to tell >>> Windows whether our application allows the transition or not. I know >>> that this can be done in general, similarly to the handling of the >>> WM_QUERYENDSESSION message, but I don't know if the VW VM supports it. I >>> guessed that the hibernation messages would be wrapped in an >>> UnknownEvent, but haven't yet been able to identify if the are passed to >>> the image by the VM, as there is a deluge of UnknownEvents when I just >>> move the mouse (Vista; I have no idea what these events mean). vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |