Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determining if a window is top most
Message
 
 
To
06/01/1999 14:21:05
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00173267
Message ID:
00173328
Views:
98
Bill,

There are a whole pile more #defines in there than necessary but it'll save looking the others up in the VC .h files. I posted code in another thread yesterday showing how to set the VFP6 help to always on top like we can do with .hlp files.
? IsTopMost( "SomeWindow Title" )

* IsTopmost.prg 06-Jan-99

* Usage IsTopMost( "SomeWindow Title" )

* returns .T.    if window is HWND_TOPMOST
*         .F.    if window isn't HWND_TOPMOST
*         .NULL. if window doesn't exist

lparameter pcWindowTitle

* Window field offsets for GetWindowLong()

#define GWL_WNDPROC         (-4)
#define GWL_HINSTANCE       (-6)
#define GWL_HWNDPARENT      (-8)
#define GWL_STYLE           (-16)
#define GWL_EXSTYLE         (-20)
#define GWL_USERDATA        (-21)
#define GWL_ID              (-12)

* Window Styles

#define WS_OVERLAPPED       0x00000000
#define WS_POPUP            0x80000000
#define WS_CHILD            0x40000000
#define WS_MINIMIZE         0x20000000
#define WS_VISIBLE          0x10000000
#define WS_DISABLED         0x08000000
#define WS_CLIPSIBLINGS     0x04000000
#define WS_CLIPCHILDREN     0x02000000
#define WS_MAXIMIZE         0x01000000
#define WS_CAPTION          0x00C00000     && WS_BORDER | WS_DLGFRAME
#define WS_BORDER           0x00800000
#define WS_DLGFRAME         0x00400000
#define WS_VSCROLL          0x00200000
#define WS_HSCROLL          0x00100000
#define WS_SYSMENU          0x00080000
#define WS_THICKFRAME       0x00040000
#define WS_GROUP            0x00020000
#define WS_TABSTOP          0x00010000

#define WS_MINIMIZEBOX      0x00020000
#define WS_MAXIMIZEBOX      0x00010000


#define WS_TILED            WS_OVERLAPPED
#define WS_ICONIC           WS_MINIMIZE
#define WS_SIZEBOX          WS_THICKFRAME
#define WS_TILEDWINDOW      WS_OVERLAPPEDWINDOW

*
* Common Window Styles
*
*#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED     | \
*                             WS_CAPTION        | \
*                             WS_SYSMENU        | \
*                             WS_THICKFRAME     | \
*                             WS_MINIMIZEBOX    | \
*                             WS_MAXIMIZEBOX)
*
*#define WS_POPUPWINDOW      (WS_POPUP          | \
*                             WS_BORDER         | \
*                             WS_SYSMENU)
*
*#define WS_CHILDWINDOW      (WS_CHILD)

*
* Extended Window Styles
*
#define WS_EX_DLGMODALFRAME     0x00000001
#define WS_EX_NOPARENTNOTIFY    0x00000004
#define WS_EX_TOPMOST           0x00000008
#define WS_EX_ACCEPTFILES       0x00000010
#define WS_EX_TRANSPARENT       0x00000020

#define WS_EX_MDICHILD          0x00000040
#define WS_EX_TOOLWINDOW        0x00000080
#define WS_EX_WINDOWEDGE        0x00000100
#define WS_EX_CLIENTEDGE        0x00000200
#define WS_EX_CONTEXTHELP       0x00000400

#define WS_EX_RIGHT             0x00001000
#define WS_EX_LEFT              0x00000000
#define WS_EX_RTLREADING        0x00002000
#define WS_EX_LTRREADING        0x00000000
#define WS_EX_LEFTSCROLLBAR     0x00004000
#define WS_EX_RIGHTSCROLLBAR    0x00000000

#define WS_EX_CONTROLPARENT     0x00010000
#define WS_EX_STATICEDGE        0x00020000
#define WS_EX_APPWINDOW         0x00040000

*#define WS_EX_OVERLAPPEDWINDOW  (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
*#define WS_EX_PALETTEWINDOW     (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST)

declare integer FindWindow in win32api ;
  string lpClassName, ; && pointer to class name
  string lpWindowName   && pointer to window name

declare integer GetWindowLong in win32api ;
  integer hWnd,  ; && handle of window
  integer nIndex   && offset of value to retrieve

local lnHWnd, llRetVal

lnHwnd = FindWindow( .null., pcWindowTitle )

if ( lnHwnd > 0 )
   llRetVal = ( bitand( GetWindowLong( lnHwnd, GWL_EXSTYLE ), WS_EX_TOPMOST ) = WS_EX_TOPMOST )
else
   llRetVal = .null.
endif

return llRetVal
>Is it possible to query a window to determine if it has been set as a top most window? I.e. if SetWindowPos() is used to set a window as top most ( HWND_TOPMOST ), is there an API function to query that window to determine if it is a top most window?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform