Ed,
But mainhwnd() is just as easy and doesn't require VFP being the active window at the time.
>In addition, you can use the extrememly simple GetActiveWindow API call as long as VFP has focus:
>
>DECLARE INTEGER GetActiveWindow IN WIN32API
>nhWnd = GetActiveWindow()