Produced by Araxis Merge on 3/31/2017 10:45:42 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\VITALSCOMMON | fGMV_TimeOutManager.pas | Tue Dec 13 18:26:00 2016 UTC |
2 | CPRS v31A.zip\CPRS v31A\VITL5_P34_src.zip\Source\VITALSCOMMON | fGMV_TimeOutManager.pas | Fri Mar 31 15:01:19 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 452 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | unit fGMV_ TimeOutMan ager; | |
2 | { | |
3 | ========== ========== ========== ========== ========== ========== ========== ========== | |
4 | * | |
5 | * Ap plication: Vitals | |
6 | * Re vision: $Revisio n: 1 $ $M odtime: 4/ 29/09 9:30 a $ | |
7 | * Developer: PII | |
8 | * Si te: Hines OI FO | |
9 | * | |
10 | * De scription: Time Out functiona lity (Just like Roll 'n'Scroll) | |
11 | * | |
12 | * No tes: | |
13 | * | |
14 | ========== ========== ========== ========== ========== ========== ========== ========== | |
15 | * $A rchive: /V itals/5.0 (Version 5 .0)/5.0.23 (Patch 23 )/VITALS_5 _0_23_8/So urce/VITAL SCOMMON/fG MV_TimeOut Manager.pa s $ | |
16 | * | |
17 | * | |
18 | * | |
19 | ========== ========== ========== ========== ========== ========== ========== ========== | |
20 | } | |
21 | ||
22 | interface | |
23 | ||
24 | uses | |
25 | Windows, | |
26 | Messages , | |
27 | SysUtils , | |
28 | Classes, | |
29 | Graphics , | |
30 | Controls , | |
31 | Forms, | |
32 | Dialogs, | |
33 | ExtCtrls , | |
34 | StdCtrls ; | |
35 | ||
36 | type | |
37 | TfrmGMV_ TimeOutMan ager = cla ss(TForm) | |
38 | LastCh anceTimer: TTimer; | |
39 | Label1 : TLabel; | |
40 | lblSec ondsLeft: TLabel; | |
41 | lblMes sage: TLab el; | |
42 | btnCan celTimeout : TButton; | |
43 | proced ure LastCh anceTimerT imer(Sende r: TObject ); | |
44 | private | |
45 | Second sLeft: Int eger; | |
46 | public | |
47 | { Publ ic declara tions } | |
48 | end; | |
49 | ||
50 | type | |
51 | TMDShutD ownProcedu re = proce dure; | |
52 | ||
53 | procedure InitTimeOu t(ShutDown ProcedureN ame: TMDSh utDownProc edure); | |
54 | procedure UpdateTime OutInterva l(Seconds: Cardinal) ; | |
55 | procedure ShutDownTi meOut; | |
56 | ||
57 | implementa tion | |
58 | {$IFDEF DL L} | |
59 | uses frmPa tientVital s; | |
60 | {$ENDIF} | |
61 | ||
62 | type | |
63 | TMDTimeO ut = class (TTimer) | |
64 | private | |
65 | FHooke d: Boolean ; | |
66 | TimeOu tInterval: Cardinal; | |
67 | TimeOu tKeyHandle : HHOOK; | |
68 | TimeOu tMouseHand le: HHOOK; | |
69 | ShutDo wnProcedur e: TMDShut DownProced ure; | |
70 | protecte d | |
71 | proced ure ResetT imeOut; | |
72 | proced ure TimeOu tTimer(Sen der: TObje ct); | |
73 | end; | |
74 | ||
75 | var | |
76 | MDTimeOu t: TMDTime Out = nil; | |
77 | ||
78 | function T imeoutKeyH ook(Code: Integer; w Param: WPA RAM; lPara m: LPARAM) : LRESULT; stdcall; forward; | |
79 | ||
80 | function T imeoutMous eHook(Code : Integer; wParam: W PARAM; lPa ram: LPARA M): LRESUL T; stdcall ; forward; | |
81 | ||
82 | {$R *.DFM} | |
83 | ||
84 | function T imeoutKeyH ook(Code: Integer; w Param: WPA RAM; lPara m: LPARAM) : LRESULT; | |
85 | { this is called for every key board even t that occ urs } | |
86 | begin | |
87 | Result : = 0; | |
88 | if lPara m shr 31 = 1 then | |
89 | MDTime Out.ResetT imeout; // on KeyUp only | |
90 | try | |
91 | Result := CallNe xtHookEx(M DTimeOut.T imeoutKeyH andle, Cod e, wParam, lParam); | |
92 | except | |
93 | end; | |
94 | end; | |
95 | ||
96 | function T imeoutMous eHook(Code : Integer; wParam: W PARAM; lPa ram: LPARA M): LRESUL T; | |
97 | { this is called for every mou se event t hat occurs } | |
98 | begin | |
99 | Result : = 0; | |
100 | if (Code >= 0) and (wParam > WM_MOUSEF IRST) and (wParam <= WM_MOUSEL AST) then | |
101 | MDTime Out.ResetT imeout; // all click events | |
102 | try | |
103 | Result := CallNe xtHookEx(M DTimeOut.T imeoutMous eHandle, C ode, wPara m, lParam) ; | |
104 | except | |
105 | end; | |
106 | end; | |
107 | ||
108 | procedure InitTimeOu t(ShutDown ProcedureN ame: TMDSh utDownProc edure); | |
109 | begin | |
110 | if (not assigned(M DTimeOut)) then | |
111 | begin | |
112 | MDTi meOut := T MDTimeOut. Create(App lication); | |
113 | with MDTimeOut do | |
114 | be gin | |
115 | ShutDownPr ocedure := ShutDownP rocedureNa me; | |
116 | OnTimer := TimeOutTi mer; | |
117 | TimeOutInt erval := 1 0000; | |
118 | TimeOutKey Handle := | |
119 | SetWindo wsHookEx(W H_KEYBOARD , TimeOutK eyHook, 0, GetCurren tThreadID) ; | |
120 | TimeOutMou seHandle : = | |
121 | SetWindo wsHookEx(W H_MOUSE, T imeOutMous eHook, 0, GetCurrent ThreadID); | |
122 | Interval : = TimeOutI nterval; | |
123 | Enabled := True; | |
124 | FHooked := True; | |
125 | en d; | |
126 | end; | |
127 | end; | |
128 | ||
129 | procedure UpdateTime OutInterva l(Seconds: Cardinal) ; | |
130 | begin | |
131 | if (assi gned(MDTim eOut)) the n | |
132 | with M DTimeOut d o | |
133 | begi n | |
134 | In terval := Seconds * 1000; | |
135 | Ti meOutInter val := Sec onds * 100 0; | |
136 | En abled := T rue; | |
137 | end; | |
138 | end; | |
139 | ||
140 | procedure ShutDownTi meOut; | |
141 | begin | |
142 | if (assi gned(MDTim eOut)) the n | |
143 | begin | |
144 | with MDTimeOut do | |
145 | be gin | |
146 | Enabled := False; | |
147 | if FHooked then | |
148 | begin | |
149 | Unhook WindowsHoo kEx(TimeOu tKeyHandle ); | |
150 | Unhook WindowsHoo kEx(TimeOu tMouseHand le); | |
151 | FHooke d := False ; | |
152 | end; | |
153 | en d; | |
154 | Fr eeAndNil(M DTimeOut); // AAN 0 40406 | |
155 | end; | |
156 | end; | |
157 | ||
158 | procedure TMDTimeOut .ResetTime out; | |
159 | { this res tarts the timer when ever there is a keyb oard or mo use event } | |
160 | begin | |
161 | Enabled := False; | |
162 | Interval := Timeou tInterval; | |
163 | Enabled := True; | |
164 | end; | |
165 | ||
166 | procedure TMDTimeOut .TimeOutTi mer(Sender : TObject) ; | |
167 | { when the timer exp ires, the applicatio n is close d after wa rning the user } | |
168 | begin | |
169 | Enabled := False; | |
170 | {$IFNDEF D LL} //vhai shandria 0 50425 | |
171 | { Check for minimi zed main f orm and th en bring t o front } | |
172 | with App lication d o | |
173 | begin | |
174 | if M ainForm <> nil then | |
175 | if MainForm. WindowStat e = wsMini mized then | |
176 | MainForm.W indowState := wsNorm al; | |
177 | Brin gToFront; | |
178 | Proc essMessage s; | |
179 | end; | |
180 | ||
181 | with Tfr mGMV_TimeO utManager. Create(App lication) do | |
182 | try | |
183 | lblMes sage.Capti on := | |
184 | 'The applicati on ' + App lication.T itle + ' i s about to ' + | |
185 | 'clo se due to inactivity . Press t he &Cancel button be low to ' + | |
186 | 'con tinue work ing.'; | |
187 | Second sLeft := 1 5; | |
188 | LastCh anceTimer. Interval : = 1000; | |
189 | LastCh anceTimer. Enabled := True; | |
190 | ShowMo dal; | |
191 | LastCh anceTimer. Enabled := False; | |
192 | if Mod alResult < > mrCancel then | |
193 | if a ssigned(Sh utDownProc edure) the n | |
194 | Sh utDownProc edure | |
195 | else | |
196 | Ap plication. Terminate | |
197 | else | |
198 | Self .Enabled : = True; | |
199 | finally | |
200 | Free; | |
201 | end; | |
202 | {$ELSE} | |
203 | // if Ass igned(frmV itals) the n | |
204 | // frmV itals.Moda lResult := mrCancel; | |
205 | Applicat ion.Termin ate; | |
206 | {$ENDIF} | |
207 | end; | |
208 | ||
209 | ////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// | |
210 | ||
211 | procedure TfrmGMV_Ti meOutManag er.LastCha nceTimerTi mer(Sender : TObject) ; | |
212 | begin | |
213 | LastChan ceTimer.En abled := F alse; | |
214 | dec(Seco ndsLeft); | |
215 | lblSecon dsLeft.Cap tion := In tToStr(Sec ondsLeft); | |
216 | LastChan ceTimer.En abled := ( SecondsLef t > 0); | |
217 | if not L astChanceT imer.Enabl ed then | |
218 | ModalR esult := m rOk; | |
219 | end; | |
220 | ||
221 | initializa tion | |
222 | initTime Out(nil); | |
223 | UpdateTi meoutInter val(10000) ; | |
224 | ||
225 | finalizati on | |
226 | shutDown TimeOut; | |
227 | end. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.