Starting a thread on a timer

I have a popup window for reminders that opens a new MDI window. If someone has a modal window open then the program will halt with an error that the application is not active. I found the following code to prevent this issue. ( from the newsgroups )

Global Map:-

module('win32')
  apiGetFocus,long,pascal,name('GetFocus')
  apiIsWindowEnabled(long hwnd),long,pascal,name('IsWindowEnabled')
end

in code

if apiIsWindowEnabled(frame{prop:handle}) <> 0 and apiGetFocus() <> frame{prop:handle}
 
end