>Based on a message on the thread, I did the following code (It is used when doing a Crystal report, to make sure my app is waiting for completion of Crystal):
>
>#DEFINE WS_MAXIMIZE 29949952
>Declare integer GetForegroundWindow in WIN32API
>Declare short IsWindow in WIN32API
>...blablabla I call Crystal in preview mode...
>
>lnHwndActiveX = GetForegroundWindow()
>Do while IsWindow(lnHwndActiveX) # 0
>Enddo
>
>It fail on the second line (Declare integer GetForegroundWindow...).
>DO I have to do something else in order to use Win32api ?
>
No, but it is case-sensitive - IOW GETFOREGROUNDWINDOW is not the same as GetForegroundWindow; the API call works under NT and Win98.
When you say it fails, what error does it give you - it's sort of useless to not say what the error message was.
Also, if you read the documentation, GetForegroundWindow does not always return a valid hWnd - ie it returns NULL if a window is losing its activation status.