What is the gui for .Net equivalent of wait-for XXX pause ti

Posted by cverbiest on 26-Oct-2011 04:30

In our non GUI for .Net application we use

wait-for close of this-procedure pause L-TIMEOUT.

we now have

wait-for System.Windows.Forms.Application:Run (this-object).

How can we make this terminate after L-TIMOUT seconds of inactivity ?

Some of our customers have this as a security requirement.

Regards,

Carl Verbiest

All Replies

Posted by Admin on 26-Oct-2011 06:09

> wait-for System.Windows.Forms.Application:Run (this-object).

You'll probably have to use a System.Windows.Forms.Timer component (don't use the System.Threading.Timer) and subscribe to the Tick event. When Tick fires, close the Form that the WAIT-FOR is using (THIS-OBJECT in your sample) by calling the Form's Close() method.

If you are having a FormClosing event handler anywhere (in that Form, a child Form) you may need to check the CloseReason in there.

Posted by cverbiest on 26-Oct-2011 06:46

Hi Mike,

That may be part of the solution but it does not take in-activity into account.

We would need a way to reset that timer "on any-activitiy anywhere".

I'll try something along that line.

Posted by Roger Blanchard on 31-Oct-2011 12:51

Carl,

We do something similar for PCI compliance. After 15 minutes of inactivity we produce a dialog box prompting the user for their user name and password. If they properly enter the credentials they are back at the form they were at but if not we close the app. We use a Timer as Mike suggested and during the Tick event we check ETIME and if GE 90000 then produce the dialog. We use the WndProc OVERRIDE of our MainMenu to reset ETIME.

METHOD

OVERRIDE PROTECTED VOID WndProc( INPUT-OUTPUT m AS System.Windows.Forms.Message ):

     SUPER:WndProc(INPUT-OUTPUT m).

     IF (m:Msg GE 256 AND m:Msg LE 264) OR (m:Msg GE 512 AND m:Msg LE 521) OR (m:Msg EQ 33) THEN /* the 33 is when the mouse is clicked in a child form..bug in OE? */

     DO:

          /* a keyboard or mouse event of some kind was generated so we need to reset our timer */

        

          ETIME (TRUE).

     END.

END METHOD.

Posted by Admin on 31-Oct-2011 13:00

WndProc is called very often (whenever there is something in the Message-Queue, like a key press of mouse move). Does it perform well from ABL code?

I'd consider overriding the WndProc in a C# class (importing Progress.NetUI.dll into a Visual Studio solution), handling all timer related stuff there and create a "LockWindow" event on the C# side to that you could subscribe from the AVM.

I have the feeling that that should perform much better...

Posted by Roger Blanchard on 31-Oct-2011 13:02

Hmm, we have not noticed any performance issues in our testing and have not received any complains from our customers. We will have to test with and without that enabled.

Thanks.

Posted by cverbiest on 20-Dec-2011 02:28

Hi Roger,

We tried your approach and managed to construct a time-out mechanism with it but we ran into unwanted side-effects.

Some keyboard activitity was not detected as activity, this can probably be fixed by detecting more message types.

The other thing we had was that errors thrown from within a database trigger were caught as unhandled exceptions in WndProc. Because of this effect we removed the WndProc override.

For the moment we will still use etime(yes) but we will put it in certain central spots of the application (refresh query, toolbar/menu selection, ...).

Posted by Roger Blanchard on 20-Dec-2011 06:11

Carl,

I am sorry to hear that. I have not seen that but we are running against an Appserver so all of out DB triggers are running on the Appserver. As another alternative Mike F. mentioned using C# for the override so maybe that would be better. I have not done that so I cannot help you out with that.

good luck.

Posted by jquerijero on 30-Mar-2012 17:22

I used this technique before although in Visual Studio project, but I don't see a problem creating a DLL that you can reference in you ABL project.

http://blog.rees.biz/2010/12/global-hotkeys-and-user-activity.html

This thread is closed