Produced by Araxis Merge on 3/22/2018 8:25:51 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 | Build_3_Patch_32_Jan_2018.zip\CCR_CompSample | fGMV_TimeOutManager.pas | Thu Mar 15 14:55:14 2018 UTC |
| 2 | Build_3_Patch_32_Jan_2018.zip\CCR_CompSample | fGMV_TimeOutManager.pas | Fri Mar 16 21:00:55 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 394 |
| 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: 3 $ $M odtime: 4/ 26/07 9:27 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: /C CR v1.5/Cu rrent/fGMV _TimeOutMa nager.pas $ | |
| 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 | end; | |
| 47 | ||
| 48 | type | |
| 49 | TMDShutD ownProcedu re = proce dure; | |
| 50 | ||
| 51 | procedure InitTimeOu t(ShutDown ProcedureN ame: TMDSh utDownProc edure); | |
| 52 | procedure UpdateTime OutInterva l(Seconds: Cardinal) ; | |
| 53 | procedure ShutDownTi meOut; | |
| 54 | ||
| 55 | implementa tion | |
| 56 | ||
| 57 | type | |
| 58 | TMDTimeO ut = class (TTimer) | |
| 59 | private | |
| 60 | FHooke d: Boolean ; | |
| 61 | TimeOu tInterval: Cardinal; | |
| 62 | TimeOu tKeyHandle : HHOOK; | |
| 63 | TimeOu tMouseHand le: HHOOK; | |
| 64 | ShutDo wnProcedur e: TMDShut DownProced ure; | |
| 65 | protecte d | |
| 66 | proced ure ResetT imeOut; | |
| 67 | proced ure TimeOu tTimer(Sen der: TObje ct); | |
| 68 | end; | |
| 69 | ||
| 70 | var | |
| 71 | MDTimeOu t: TMDTime Out = nil; | |
| 72 | ||
| 73 | function T imeoutKeyH ook(Code: Integer; w Param: WPA RAM; lPara m: LPARAM) : LRESULT; stdcall; forward; | |
| 74 | ||
| 75 | function T imeoutMous eHook(Code : Integer; wParam: W PARAM; lPa ram: LPARA M): LRESUL T; stdcall ; forward; | |
| 76 | ||
| 77 | {$R *.DFM} | |
| 78 | ||
| 79 | function T imeoutKeyH ook(Code: Integer; w Param: WPA RAM; lPara m: LPARAM) : LRESULT; | |
| 80 | { this is called for every key board even t that occ urs } | |
| 81 | begin | |
| 82 | if lPara m shr 31 = 1 then | |
| 83 | MDTime Out.ResetT imeout; // on KeyUp only | |
| 84 | Result : = CallNext HookEx(MDT imeOut.Tim eoutKeyHan dle, Code, wParam, l Param); | |
| 85 | end; | |
| 86 | ||
| 87 | function T imeoutMous eHook(Code : Integer; wParam: W PARAM; lPa ram: LPARA M): LRESUL T; | |
| 88 | { this is called for every mou se event t hat occurs } | |
| 89 | begin | |
| 90 | if (Code >= 0) and (wParam > WM_MOUSEF IRST) and (wParam <= WM_MOUSEL AST) then | |
| 91 | MDTime Out.ResetT imeout; // all click events | |
| 92 | Result : = CallNext HookEx(MDT imeOut.Tim eoutMouseH andle, Cod e, wParam, lParam); | |
| 93 | end; | |
| 94 | ||
| 95 | procedure TMDTimeOut .ResetTime out; | |
| 96 | { this res tarts the timer when ever there is a keyb oard or mo use event } | |
| 97 | begin | |
| 98 | Enabled := False; | |
| 99 | Interval := Timeou tInterval; | |
| 100 | Enabled := True; | |
| 101 | end; | |
| 102 | ||
| 103 | procedure TMDTimeOut .TimeOutTi mer(Sender : TObject) ; | |
| 104 | { when the timer exp ires, the applicatio n is close d after wa rning the user } | |
| 105 | begin | |
| 106 | Enabled := False; | |
| 107 | ||
| 108 | { Check for minimi zed main f orm and th en bring t o front } | |
| 109 | with App lication d o | |
| 110 | begin | |
| 111 | if M ainForm <> nil then | |
| 112 | if MainForm. WindowStat e = wsMini mized then | |
| 113 | MainForm.W indowState := wsNorm al; | |
| 114 | Brin gToFront; | |
| 115 | Proc essMessage s; | |
| 116 | end; | |
| 117 | ||
| 118 | with Tfr mGMV_TimeO utManager. Create(App lication) do | |
| 119 | try | |
| 120 | lblMes sage.Capti on := | |
| 121 | 'The applicati on ' + App lication.T itle + ' i s about to ' + | |
| 122 | 'clo se due to inactivity . Press t he &Cancel button be low to ' + | |
| 123 | 'con tinue work ing.'; | |
| 124 | Second sLeft := 1 5; | |
| 125 | LastCh anceTimer. Interval : = 1000; | |
| 126 | LastCh anceTimer. Enabled := True; | |
| 127 | ShowMo dal; | |
| 128 | LastCh anceTimer. Enabled := False; | |
| 129 | if Mod alResult < > mrCancel then | |
| 130 | if A ssigned(Sh utDownProc edure) the n | |
| 131 | Sh utDownProc edure | |
| 132 | else | |
| 133 | Ap plication. Terminate | |
| 134 | else | |
| 135 | Self .Enabled : = True; | |
| 136 | finally | |
| 137 | Free; | |
| 138 | end; | |
| 139 | end; | |
| 140 | ||
| 141 | procedure InitTimeOu t(ShutDown ProcedureN ame: TMDSh utDownProc edure); | |
| 142 | begin | |
| 143 | if not A ssigned(MD TimeOut) t hen | |
| 144 | begin | |
| 145 | MDTi meOut := T MDTimeOut. Create(App lication); | |
| 146 | with MDTimeOut do | |
| 147 | be gin | |
| 148 | ShutDownPr ocedure := ShutDownP rocedureNa me; | |
| 149 | OnTimer := TimeOutTi mer; | |
| 150 | TimeOutInt erval := 1 0000; | |
| 151 | TimeOutKey Handle := | |
| 152 | SetWindo wsHookEx(W H_KEYBOARD , TimeOutK eyHook, 0, GetCurren tThreadID) ; | |
| 153 | TimeOutMou seHandle : = | |
| 154 | SetWindo wsHookEx(W H_MOUSE, T imeOutMous eHook, 0, GetCurrent ThreadID); | |
| 155 | Interval : = TimeOutI nterval; | |
| 156 | Enabled := True; | |
| 157 | FHooked := True; | |
| 158 | en d; | |
| 159 | end; | |
| 160 | end; | |
| 161 | ||
| 162 | procedure UpdateTime OutInterva l(Seconds: Cardinal) ; | |
| 163 | begin | |
| 164 | if Assig ned(MDTime Out) then | |
| 165 | with M DTimeOut d o | |
| 166 | begi n | |
| 167 | In terval := Seconds * 1000; | |
| 168 | Ti meOutInter val := Sec onds * 100 0; | |
| 169 | En abled := T rue; | |
| 170 | end; | |
| 171 | end; | |
| 172 | ||
| 173 | procedure ShutDownTi meOut; | |
| 174 | begin | |
| 175 | if Assig ned(MDTime Out) then | |
| 176 | with M DTimeOut d o | |
| 177 | begi n | |
| 178 | En abled := F alse; | |
| 179 | if FHooked t hen | |
| 180 | begin | |
| 181 | UnhookWi ndowsHookE x(TimeOutK eyHandle); | |
| 182 | UnhookWi ndowsHookE x(TimeOutM ouseHandle ); | |
| 183 | FHooked := False; | |
| 184 | end; | |
| 185 | end; | |
| 186 | end; | |
| 187 | ||
| 188 | procedure TfrmGMV_Ti meOutManag er.LastCha nceTimerTi mer(Sender : TObject) ; | |
| 189 | begin | |
| 190 | LastChan ceTimer.En abled := F alse; | |
| 191 | Dec(Seco ndsLeft); | |
| 192 | lblSecon dsLeft.Cap tion := In tToStr(Sec ondsLeft); | |
| 193 | LastChan ceTimer.En abled := ( SecondsLef t > 0); | |
| 194 | if not L astChanceT imer.Enabl ed then | |
| 195 | ModalR esult := m rOk; | |
| 196 | end; | |
| 197 | ||
| 198 | end. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.