Taskbar button does not activate dialog form

Greetings, Experts!

Trying to develop a Delphi5-DLL, that is called by a macro from MS
Word 2000, I encounter some problems bringing my DLL-form back to top
after another application-window has been activated to be the topmost
window. Anyone of you might be of highly appreciated assistance in
solving that problem.

My system components are:

- Delphi 5 - Update Pack 1
- MS Windows 2000 - SP 1
- MS Office 2000 - SR 1.

My DLL consists of one form, BorderStyle = bsDialog. MS Word calls
that DLL passing its own window handle as a parameter, so that the
DLL-form is created as a child of the MS Word-window using
"CreateParented" and then modally shown. Everything so far works all
right: When MS Word calls the DLL the DLL-form is created, modally
shown as topmost window and - according to the user's input - finally
closed and destroyed.

When the DLL-window is topmost and has the focus, the user can
activate (ALT+TAB or taskbar button) or start another application
which is then brought to the foreground. Using ALT+TAB again to
reactivate MS Word works fine, too: MS Word and the modal
DLL-dialogform reappear on the top of all other windows. The
dialog-form still has the focus, of course.

And now for the problem: When using the taskbar button of MS Word to
reactivate MS Word and the still active DLL-window, it is not really
brought back to the front. The other application which has been active
until pressing the taskbar button of MS Word does lose its focus, but
MS Word and the DLL-window still remain unseen (cause the prior
application had been maximized ;-)).

Does anyone of you know how those differences between using ALT+TAB
and using the taskbar button can be explained? How can I solve my
problem of bringing back MS Word to the top when the user presses the
appropriate taskbar button?

I know you can do it!

Best regards,

Martina Hoffmann