At the risk of making this sound like a poker commercial:
I'm snk13 @ bodog.com. Come play with me! :)
cheers
jk
I'm snk13 @ bodog.com. Come play with me! :)
[C#]
public class MyForm : Form
{
[DllImport("user32.dll", CharSet=CharSet.Auto, CallingConvention=CallingConvention.Winapi)]
internal static extern IntPtr GetFocus();
private Control GetFocusedControl()
{
Control focusedControl = null;
// To get hold of the focused control:
IntPtr focusedHandle = GetFocus();
// Note that if the focused Control is not a .Net control,
//then this will return null.
if(focusedHandle != IntPtr.Zero)
focusedControl = Control.FromHandle(focusedHandle);
return focusedControl;
}
}
public List< T > ConvertListToListT< T >(System.Collections.IList list)
{
List< T > ret = new List< T >();
foreach (T o in list)
{
ret.Add(o);
}
return ret;
}
Programmers are optimists. We assume that each feature in the specification
for a project can be added in a constant amount of time even as the code grows,
and we add each new feature just like we added the last. In other words, that
programs are completed in linear time. The last half, recursively, takes twice
as long.