www.icetips.com  Icetips Utilities Documentation 5/15/2016    

Procedure Extension Template: Icetips Thread Limiter - Procedure

Previous  Top  Next  


This template enables thread limiting on a procedure.   Select the "ITProcThreadLimiter - Icetips Thread Limiter - Procedure" template.  Note that this template will only show up in the "Select Extension" window if the "Include Thread Limiter" is checked on the Icetips Utilities Classes Global template. 

 

To use this template, check the "Include Thread Limiter" on the Icetips Utilities Classes Global template.  Then add the procedure extension (see below) and set up the "Maximum Runs" if necessary.  Compile and run.  For multi-DLL applications, you must check the "Include Thread Limiter" on both the DLL app that exports file declarations and also in the app where you need the Thread Limiter.  Make sure that you compile the exporting dll!

 

The Thread Limiter keeps track of each time that a procedure with the procedure extension is opened.  Note that the extension should work on all normal window procedures, but is not designed to work on reports or processes and has not been tested for that.  If you need it to work on different type of procedures please let us know and we will add additional support for other procedure types. 

 

If it exceeds the maximum number of instances allowed, it will trigger the locally derived TakeLimit method to be called.  By embedding code in that method you can control how you handle the limitation.  The method calls its parent TakeLimit method which activates the last instance of the procedure.  The activation brings the last instance to top, selects the window and if the window was minimized it is restored. 

 

Thread_limit_Procedure_Add

Once you have added it to the template you can change the classname and the maximum number of times the procedure will run.

 

Thread_limit_Procedure_Template

 

The template adds embeds to override one method in the derived ITThreadLimitClass class, the TakeLimit method which is called when the procedure has already been run "Maximum runs" times.  You can embed code into this embed for example to show a message or do some other activity. 

 

Thread_limit_Procedure_Embeds

You have an embed in the data section and two embeds in the code section, before and after parent call:

 

Thread_limit_Procedure_Embeditor

 

PARENT.TakeLimit will activate the last instance of the procedure, bring it into focus and bring it to top of other windows. 

 

 



Direct link to this page: http://www.icetips.com/manuals/utilities/threadlimiterproc.htm