Webinar: Features of .NET 4.0

Today, I delivered a Webinar on ‘Features of .NET 4.0

Total duration of webinar: 1 hour
Total participants: 200

Take away from the session:

  • Features of .NET 4.0
  • Optimizations in .NET 4.0 vs .NET 3.5
  • New look of WCF in .NET 4.0
  • New in Silverlight 4.0
Continue reading » · Rating: · Written on: 04-18-10 · No Comments »

Finding currently focused control

Good question!  Now, this was a question in one of my sessions at Microsoft Community at Cognizant.  We need to use User32 API’s to do this stuff. It isn’t that difficult. Just a small snippet and you are through!

Here’s the neat solution.

[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();

          if(focusedHandle != IntPtr.Zero){

                 // Note that if the focused Control is not a .Net control, then this will return null.
                focusedControl = Control.FromHandle(focusedHandle);
         }
         return focusedControl;
}

Continue reading » · Rating: · Written on: 05-14-09 · No Comments »