Forcing FoxPro Window to Always Remain on TopLast reviewed: April 30, 1996Article ID: Q108623 |
The information in this article applies to:
SUMMARYThe sample code below forces the main FoxPro window to remain on top of all other windows. It demonstrates how to use the FOXTOOLS.FLL library commands to call the SetWindowPos() Microsoft Windows application programming interface (API) function.
MORE INFORMATIONThe program first declares some compile-time constants (to improve readability) and loads the FOXTOOLS.FLL library that is supplied with FoxPro for Windows. It then retrieves the handle to the main FoxPro window using a call to MainHWND(), which is a function residing in the FOXTOOLS.FLL library. It then calls the SetWindowPos() function and passes the handle to the main FoxPro window and the HWND_TOPMOST constant to make sure that window always remains on top.
*** Define compile-time constants #DEFINE HWND_TOPMOST -1 #DEFINE HWND_NOTOPMOST -2 #DEFINE SWP_NOSIZE 1 #DEFINE SWP_NOMOVE 2 *** Load FoxTools library SET LIBRARY TO SYS(2004)+"FOXTOOLS" *** Register the Windows API function setwin=RegFn("SetWindowPos","IIIIIII","I") *** Obtain handle to main FoxPro window handle=mainhwnd() *** Call SetWindowPos() API function =CallFn(setwin,handle,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE+SWP_NOSIZE) *** Release the FoxTools library SET LIBRARY TOIn order to remove the "always on top" attribute from the main FoxPro window, the program above could be modified to make the CallFn() line use the constant HWND_NOTOPMOST instead of HWND_TOPMOST as the third argument.
REFERENCESMicrosoft Windows Software Development Kit, "Programmer's Reference, Volume 2: Functions," page 892 FOXTOOLS.WRI located in the C:\FOXPROW\GOODIES\FOXTOOLS subdirectory
|
Additional reference words: VFoxWin 3.00 FoxWin 2.50 2.50a 2.50b 2.60 2.60a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |