Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need To Close An Application
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00691241
Message ID:
00691511
Vues:
18
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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform