Sean,
It could be that initializing the P/Invoke layer is taking all the time,
as well as finding the dll to load, and then setting up the call. Of
course, on subsequent calls, the initialization of the P/Invoke layer is not
needed, and I am sure that a thunk has already been created to call into the
function (since you did it once already).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Sean Dudley" <du*****@uwplatt.edu> wrote in message
news:uN**************@TK2MSFTNGP11.phx.gbl...
I am currently enumerating windows via the EnumWindows API.
I noticed that for some reason the very first time I call my enumwindows
routine (inside or outside of a thread) it seems to be very slow. But
subsequent times in the same running instance the calls are super quick.
What might cause an API call like this to be very, very slow the first
time it is called and fast the rest of the times?