Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a better kludge for SetForegroundWindow?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00671245
Message ID:
00671554
Vues:
23
>Running under Win2K Pro with either VFP6 or VFP7, the following program demonstrates that the SetForegroundWindow API function fails to restore the focus to the main VFP window:
>Instead of activating the VFP window at this point, its taskbar button starts flashing. I've tried lots of programmatic ways to get the focus to return to VFP, and the "best" I've been able to do so far is to use the following kludge instead of SetForegroundWindow:
> Has anyone found a better solution that would work for this example under Windows 2000? Please test to confirm if you think so. TIA for any help.

"When all else fails, read the instructions" (Cahn's Axiom).

MSDN, SetForegroundWindow:
"Windows 98/Me, Windows 2000 or later:
With this change, an application cannot force a window to the foreground while the user is working with another window. Instead, SetForegroundWindow will activate the window (see SetActiveWindow) and call the FlashWindowEx function to notify the user. However, on Windows 98, if a nonforeground thread calls SetForegroundWindow and passes the handle of a window that was not created by the calling thread, the window is not flashed on the taskbar. To have SetForegroundWindow behave the same as it did on Windows 95 and Windows NT 4.0, change the foreground lock timeout value when the application is installed. This can be done from the setup or installation application with the following function call:

SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)0, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);

This method allows SetForegroundWindow on Windows 98 and Windows 2000 to behave the same as Windows 95 and Windows NT 4.0, respectively, for all applications. The setup application should warn the user that this is being done so that the user isn't surprised by the changed behavior. On Windows 2000, the SystemParametersInfo call fails unless the calling thread can change the foreground window, so this must be called from a setup or patch application. For more information, see Foreground and Background Windows."
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform