Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get window handle
Message
 
 
To
06/08/2003 07:28:56
Jeffrey Havelock
Skipton Information Group
Leeds, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00817229
Message ID:
00817247
Views:
16
This message has been marked as the solution to the initial question of the thread.
Hi Jeff,

Here's the piece of code I use to wait for a window to open. It wouldn't be hard to modify it to wait for window to close. The first parameter tnWindClass is usualy 0 if you are not looking for specific class of windows.
DECLARE Long FindWindow IN WIN32API STRING @lpClassName, STRING lpWindowName
DECLARE Sleep IN WIN32API Long

	PROCEDURE WaitForWindow(tnWindClass, tcWindTitle, tnWait4Wind)
	LOCAL lnStartSeconds
	* Initial delay
	Sleep(.5 * 1000) 
	lnStartSeconds = SECONDS()
	DO WHILE FindWindow(tnWindClass, tcWindTitle) <= 32 ;
			AND (SECONDS()-lnStartSeconds < tnWait4Wind)
		DOEVENTS
		Sleep(.5 * 1000) 
	ENDDO

	RETURN FindWindow(tnWindClass, tcWindTitle) 
>Hi,
>
>I have a Fox (6.0) application which calls another piece of software by using the standard RUN command. I need to halt the code until this external software has closed itself down, therefore I want to place a timer on my form to check intermitantly for the existence of the software.
>
>Is there a standard API method for checking for existence of an open window external to Fox? All I think I need is to find a function where I can pass the window name and have its file handle returned, or 0/-1 etc. if not found.
>
>Any help appreciated as always.
>
>Regards
>
>Jeff
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform