Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need To Close An Application
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00691241
Message ID:
00691511
Views:
19
You can use code below to find application window.
#define GW_OWNER 4
#DEFINE GW_HWNDFIRST 0
#DEFINE GW_HWNDNEXT 2

declare integer GetWindowText in win32api integer, string, integer
declare integer GetWindow in win32api integer,INTEGER

foxhwnd = _VFP.hWnd
hwndNext = GetWindow(foxhwnd,GW_HWNDFIRST)
susp
**** loop thru each window to search the title
DO WHILE hwndNext <> 0
	lcBuffer = SPACE(256)
	lnTitle = GetWindowText(hwndNext,@lcBuffer,256)  && get the window text
	IF lnTitle > 0
		lcTitle = LEFT(lcBuffer, lnTitle)
		? lcTitle 
		*** check to see if this is the specified window.
		*....
	ENDIF
	hwndNext = GetWindow(hwndNext,GW_HWNDNEXT)
ENDDO
>Ok, that worked for Notepad. In my test for my app, I have:
>
>
>tcwindow = "Spot Media Tracking System - Kevin Marois"
>
>lnhwnd = FindWindow(0,tcwindow)
>
>
>
>and FindWindow is returning Zero
>
>I added GetLastError, which returned 127. From my VB API Guide, I read
>that to be:
>
>* The specified procedure could not be found.
>#DEFINE ERROR_PROC_NOT_FOUND 127
>
>Any ideas on this?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform