Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
API function for ALT+F4 shortcut
Message
De
03/08/2000 13:31:03
 
 
À
03/08/2000 12:48:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00400465
Message ID:
00400510
Vues:
13
>How can I programmatically determine which application (window title)is running on my desktop?
>

Use GetForeGroundWindow() to get the hWnd of the Foreground Window, and use the hWnd to call GetWindowText() to retrieve the title bar text:

DECLARE INTEGER GetForegroundWindow IN WIN32API
DECLARE INTEGER GetWindowText IN WIN32API INTEGER hWnd, STRING @ lpString, INTEGER nMaxCount
lpTitle = REPL(CHR(0),512)
=GetWindowText(GetForegroundWindow(),@lpTitle,511)
cWindowTitle=LEFT(lpTitle,AT(CHR(0),lpTitle)-1)

>How can I could programmatically close\Alt+F4 running application?

You can use SendMessage() to send a WM_QUIT message to the main Window of the application, and if that doesn't work, get a process handle to the application and invoke TerminateProcess() through the API.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform