API windows

Résolu
captainstf Messages postés 5 Date d'inscription mardi 17 février 2004 Statut Membre Dernière intervention 2 juillet 2009 - 14 oct. 2004 à 16:04
captainstf Messages postés 5 Date d'inscription mardi 17 février 2004 Statut Membre Dernière intervention 2 juillet 2009 - 15 oct. 2004 à 14:48
Salut à tous!

Je travaille actuelle sur l'api windows et je gallère pas mal :

1- Je cherche à mettre une application au premier plan, j'utilise :
showwindow(handle_Appli, 5)
et ça marche à la premiere execution. Si j'essaye de l'executer une seconde fois une fenetre clignote dans la barre des taches (jamais la meme) et rien ne se passe. Si je ferme et relance mon appli, ça marche de nouveau à la premiere execution.

Le handle que je passe en parametre est bien le bon.

Merci d'avance pour tout aide.
cordialement
Stéphane

4 réponses

captainstf Messages postés 5 Date d'inscription mardi 17 février 2004 Statut Membre Dernière intervention 2 juillet 2009
15 oct. 2004 à 14:48
Merci de ton aide je viens de reussir
voila ma solution pour que ça fonctionne meme lorsque la fenêtre visée est reduite :

showwindow(_childwindows.handle, 3)
BringWindowToTop(_childwindows.handle)
doevents

@+
Stf
3
FredArmoni Messages postés 153 Date d'inscription vendredi 2 mai 2003 Statut Modérateur Dernière intervention 2 avril 2010
14 oct. 2004 à 17:53
C'est normal (changement dû au nouveau standard windows qui veut qu'une appli derrière une autre n'en perturbe pas le déroulement).
Utilise plutot BrigWindowToTop

declare INTEGER BringWindowToTop INTEGER hWnd

[mailto:frederic.steczycki@mvps.org Fred]
membre actif d'AtoutFox
MS MVP VFP
0
captainstf Messages postés 5 Date d'inscription mardi 17 février 2004 Statut Membre Dernière intervention 2 juillet 2009
15 oct. 2004 à 09:46
Merci de votre aide mais cela ne resouds pas mon problème le resultat et le meme qu'avec showWindow. L'aide fournie par API-Guide 3.7 sur la fonction showWindow dit :

Specifies how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides a STARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values:

SW_HIDE
Hides the window and activates another window.
SW_MAXIMIZE
Maximizes the specified window.
SW_MINIMIZE
Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE
Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW
Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT
Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
SW_SHOWMAXIMIZED
Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED
Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE
Displays the window as a minimized window. The active window remains active.
SW_SHOWNA
Displays the window in its current state. The active window remains active.
SW_SHOWNOACTIVATE
Displays a window in its most recent size and position. The active window remains active.
SW_SHOWNORMAL

Ce que je ne capte pas c'est comment faire pour renvoyer le meme parametre qu'à la premiere execution. Si je comprends bien le fonctionnement, le parametre contenu dans STARTUPINFO et forcement une des constantes ci-dessus ?

Cordialement
Stéphane.
0
captainstf Messages postés 5 Date d'inscription mardi 17 février 2004 Statut Membre Dernière intervention 2 juillet 2009
15 oct. 2004 à 11:03
Bon j'ai trouvé un bon exemple de recuperation du STARTUPINFO :

http://www.news2news.com/vfp/?example=153&function=229

Moi j'aimerais pouvoir recuperer ces infos d'une autre appli que la mienne.
0
Rejoignez-nous