Click to See Complete Forum and Search --> : DoEvents in Class Library


saaniaferoze
December 25th, 2006, 09:57 AM
Hi,

I have a VC# dll which has a while(true) loop. I was using a DoEvents in the original code, but now when I write the dll I cant use the DoEvents !! Is there a way to use DoEvents in a Class Library?

Thanks.

wildfrog
December 27th, 2006, 02:47 PM
The DoEvents is only 'accessible' in a Forms Application (which has a windows message pump). If you got a function in a class library that runs for a long period of time you should consider running that function in a seperate thread. Another solution is to provide some kind of callback mechanism (delegate) that invokes the DoEvents function.

- petter

nartemiev
April 21st, 2008, 11:46 PM
To use DoEvents in a class library call the method directly as follows: System.Windows.Forms.Application.DoEvents()