Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win32 API Topmost Window

Status
Not open for further replies.

johnbuckley

Technical User
Mar 25, 2002
52
GB
Can anyone give me the code to return the handle of the topmost window that is running in windows please?

Thanks

 

GetForegroundWindow
function returns the handle of the foreground window (the window with which the user is currently working).

declare integer GetForegroundWindow in win32api Attitude is Everything
 
This might also do it:

Retrieves a handle to the top-level window whose class name and window name match the specified strings.


DECLARE INTEGER FindWindow IN user32;
STRING lpClassName,;
STRING lpWindowName
 
Sorry but I can't make this work. What is wrong with the following code please?

DECLARE INTEGER FindWindow IN user32;
STRING lpClassName,;
STRING lpWindowName

nHandle=FindWindow('VFP.Application','Mywindow')

This returns 0 even though a vfp application window 'Mywindow' is showing on the screen.
 
nHandle=FindWindow(.NULL.,'Mywindow')
Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top