Sorry, I can't find the code for my sliding form. But an alternative would be a "fading" form. This is a form that displays a short message of some kind in the corner of the screen, that gradually fades into view, stays visible for a short while, then fades out again. It's a good way of doing an alert that is noticeable but unobtrusive.
If that's of interest, here are the steps:
1. Create a small form. Make it top-level; no borders or title bar; ShowInTaskBar = .F. Add one or more labels to display your message. Position the form in, say, the bottom-right corner of the screen.
2. Do the following API declarations (for example, in the Load event of the above form):
Code:
DECLARE INTEGER SetWindowLong In Win32Api ;
INTEGER HWnd, INTEGER Index, INTEGER NewVal
DECLARE INTEGER SetLayeredWindowAttributes In Win32Api ;
INTEGER HWnd, STRING ColorKey, ; INTEGER Opacity, INTEGER Flags
DECLARE Sleep IN WIN32API INTEGER Duration
3. Do this in the Init:
Code:
LOCAL lnTrans
* Make the form fully transparent
SetWindowLong(THISFORM.hWnd, -20, 0x00080000)
SetLayeredWindowAttributes(THISFORM.hWnd, 0, 0, 2)
* Show the form (at this stage, nothing will appear on
* the screen, because the form is still fully transparent)
thisform.Visible = .T.
* Now gradually fade in, taking about one second to do so
lnTrans = 10
DO WHILE .T.
SetLayeredWindowAttributes(THISFORM.hWnd, 0, lnTrans, 2)
lnTrans = lnTrans + 10
IF lnTrans > 255
EXIT
ENDIF
Sleep(35) && increase for slower fading, decrease for faster
ENDDO
* The form is now fully opaque
4. Add this in the Destroy:
Code:
LOCAL lnTrans
SetWindowLong(THISFORM.hWnd, -20, 0x00080000)
* Gradually fade out, taking about one second to do so
lnTrans = 255
DO WHILE .T.
SetLayeredWindowAttributes(THISFORM.hWnd, 0, lnTrans, 2)
lnTrans = lnTrans - 10
IF lnTrans < 50
EXIT
ENDIF
Sleep(35) && increase for slower fading, decrease for faster
ENDDO
5. Add a timer to the form. Set its Interval to the number of milliseconds that you want the form to remain on the screen. In its Timer event, write code to release the form. Enable the timer at the end of the code that fades in the form (point 3, above).
6. Optionally add code to release the API declares (using CLEAR DLLS). You can do this in the form's Unload.
That's all there is to it. If you want some more information, see this article:
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads