(ANTP , POIRE JUJU le BARBARou autre ) DELPHI 5 : CB_SELECSTRING!

DELPHI 5 : CB_SELECSTRING! (ANTP , POIRE JUJU le BARBARou autre ) - Delphi/Pascal - Programmation

Marsh Posté le 06-03-2002 à 19:01:29    

salut,
 
voilà, j'aimerais bien pouvoir activer autmatiquement un fen^tre (la rendre active) : pour l'instant j'utilise la fonction EnumWindows pour voir si la fenetre cherchée existe. Une fois la classe de la fenetre et son handle récupéré, comment puis-je faire pour que lé fen^tre correspondante soit active et passe au premier plan ????
J'ai essayé la commande showwindow(hwnd,SW_show) mais sans effet!
 
Merci

 

[jfdsdjhfuetppo]--Message édité par davidmarli--[/jfdsdjhfuetppo]


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 06-03-2002 à 19:01:29   

Reply

Marsh Posté le 06-03-2002 à 19:45:07    

essaie avec SW_RESTORE ou SW_SHOWNORMAL


---------------
mes programmes ·· les voitures dans les films ·· apprenez à écrire
Reply

Marsh Posté le 07-03-2002 à 17:14:35    

bon, merci mais cela ne marche pas, la fenetre reste toujours derrière, et ne vient pas en premier plan.
 
En revanche, j'aurais besoin, de la fonction Cobobox_GetlbText. J'ai vu qu'elle était dans la SDK de windows, mais Delphi, me dit qu'il ne la connaît pas quand je compile !!!!
Comment faire pour qu'il la reconnaisse!!!
 
Merci


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 07-03-2002 à 17:51:17    

heu ça je sais pas :/
tu dois récupérer le texte de la combo box d'un autre soft ?
 
tu peux tj rajouter Poire dans ton titre, il aura peut etre une idée...

 

[jfdsdjhfuetppo]--Message édité par antp--[/jfdsdjhfuetppo]


---------------
mes programmes ·· les voitures dans les films ·· apprenez à écrire
Reply

Marsh Posté le 07-03-2002 à 21:20:38    

oui c'est out à fait ce que je veux faire !
 
ok je rajoute Poire dans mon titre


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 07-03-2002 à 21:59:12    

davidmarli a écrit a écrit :

oui c'est out à fait ce que je veux faire !
 
ok je rajoute Poire dans mon titre  




 :lol:  
j'avais lut ton pb déjà... mais C temps si j'suis 1 peu débordé... et crevé... je te promet d'y jetter 1 coupd d'oeuil
 :hello:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 07-03-2002 à 22:09:37    

Bon voila... Aprés épluchage rapide des sources de Borland je pense que tu dois utiliser SetForegroundWindow pour metre la fenetre au 1er plan.
Syntaxe :  
SetForegroundWindow
The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user.  
 
BOOL SetForegroundWindow(
 
    HWND hWnd  // handle of window to bring to foreground
   );  
 
 
Parameters
 
hWnd
 
Identifies the window that should be activated and brought to the foreground.  
 
 
 
Return Values
 
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.  
 
Remarks
 
The foreground window is the window at the top of the Z order. It is the window that the user is working with. In a preemptive multitasking environment, you should generally let the user control which window is the foreground window. However, an application can call SetForegroundWindow if it wants to put itself into the foreground to display a critical error or information that requires the user's immediate attention. A good example is a debugger when it hits a breakpoint.  
 
The system assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.  
 
See Also
 
GetForegroundWindow  
 
Pour se qui est de récupérer le texte d'1 combo G pas trouvé d'info sur la fonction que tu donnes (T sur qu'elle existe ? Bien orthographié ?)
Voila tient moi au courant....
 :hello:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 08-03-2002 à 16:49:10    

salut,
 
merci beaucoup Poire. Duand tu dis que tu as regardé dans des sources borland, ce sont des sources fournies avec Delphi ????
 
Sinon pour la fonction regarde dan l'aide de delphi (Help->windows SDK
 
Sinon connaîs tu une fonction équivalente? En faite, je voudrais que mon prog Delphi puisse choisir lui-même dans la combobox d'une autre application pour la sélectionner. Me fais-je bien comprendre ???
 
En gros, je ne sias pas si tu connais Divxauto, is je voudrais faire un prog identique.
 
Voilà, merci beaucoup pour ton aide.


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 08-03-2002 à 18:01:54    

resalut,
 
bon j'ai trouvé sur le net qq renseignements : il y a les fonctions CB_GetLbtext et CB_getcount. Cependant, ja n'ai pas bien compris leur emploi. A priori il faut utiliser la fonction sendmessage ?!?
du style sendmessage(hwnd,CB_Getcount,0,0) : mais je ne suis pas sur des deux 0. En sait-tu davantage? Si oui, peux-tu m'éclairer?


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 08-03-2002 à 18:16:29    

Salut
Pour tout te dires G cherché le source de la procedure Apllication.BringToFront ds les sources fournies avec Delphi (C + quel dossier.....)
 
Pour l'aut pb je regarde ça ;)
 :hello:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 08-03-2002 à 18:16:29   

Reply

Marsh Posté le 08-03-2002 à 18:26:39    

tu dois avoir 1 truc du genre : SendMessage(hdler, CB_GETLBTEXT, Index, @Buff);
avec hdler le handler de la fenetre où il y a la combo
Index l'index du texte à récup
Buff le buffer où sera stocké le texte


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 09-03-2002 à 13:34:53    

merci,  
 
ce que tu appelles l'index du texte à récupérer c'est par exemple : 3 si je veux le troisième choix de la combobox ????


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 09-03-2002 à 14:21:39    

davidmarli a écrit a écrit :

merci,  
 
ce que tu appelles l'index du texte à récupérer c'est par exemple : 3 si je veux le troisième choix de la combobox ????  




beh oui et non... le 1er étant 0, 3 sera le 4e  :D  
(ça dépend si on commence par 0 ou 1)
 :hello:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 09-03-2002 à 16:39:52    

bon regarde la ligne que j'ai placée dans Delphi :  
 
sendmessage(hwnd,CB_SELECTSTRING,-1,3);
 
J'ai regardé dans l'aide de Delphi : le -1, précise que la combolist est parcouru depuis le début, pour trouver la chaine de caractère, mais là où je ne comprends plus rien c'est là :  
(dans l'aide de la fonction CB_SELECTSTRING)
 
lParam = (LPARAM) (LPCSTR) lpszSelect; // address of prefix string    
 
C'est quoi prefix string ??? (String ok, mais prefix ???)
 
et ça, tu comprends ce que cela veut dire ???  
 
 
lpszSelect: Value of lParam. Points to the null-terminated string that contains the prefix to search for. The search is not case sensitive, so this string can contain any combination of uppercase and lowercase letters.  
 
En tout cas, moi je croyais qu'il fallait mettre :  
 
sendmessage(hwnd,CB_SELECTSTRING,-1,'Ce que je cherche';);
 
(où évidemment on remplace 'ce que je cherche' par un item de la combobox) mais Delphi ne veut pas compiler, pour le dernier parmètre il veut un nombre !!!! En tout cas si je mets un nombre (0ou 1, 2, 3, 4 ...) rien ne se passe.


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 09-03-2002 à 16:52:07    

non il veut pas 1 nombre mais 1 adresse
tu dois avoir 1 truc du genre (C 1 exemple)
 
MaChaine := 'Ce que je cherche';
sendmessage(hwnd,CB_SELECTSTRING,-1,@MaChaine);  
 
PS : Il supporte surement pas le string.... donc ça doit +tôt être 1 PChar....
 :hello:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 09-03-2002 à 16:56:35    

Donc :
var
  MaChaine: String;
Begin
  MaChaine := 'Ce que je cherche';  
  SendMessage(hwnd,CB_SELECTSTRING,-1,PCHAR(MaChaine));  
end;
 
C pas si ça compile G fais ça vite fait ici....
 :hello:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 09-03-2002 à 17:00:28    

ben que ce soit PCHAR, ou @ il me dit incompatible ....
 
Alors la je ne sais pas quoi faire !!!!!


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 09-03-2002 à 17:02:21    

LPARAM(PCHAR(MaChaine))


---------------
mes programmes ·· les voitures dans les films ·· apprenez à écrire
Reply

Marsh Posté le 09-03-2002 à 17:04:58    

j'ai cette ligne :  
 
t:='DivX Pro 5.0 Codec';
i:=sendmessage(hwnd,CB_SELECTSTRING,-1,LPARAM(PCHAR(t)));
 
et delphi me dit : missing operator or semicolon ????


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 09-03-2002 à 17:21:47    

t:='DivX Pro 5.0 Codec';//
  p := PCHAR(t);
  i:=sendmessage(Handle,CB_SELECTSTRING,-1,LPARAM(@p)); //
 
pas tester non +... pas le temps là désolé
p : PChar
T : String


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 09-03-2002 à 17:24:21    

idem missing operatoe or semicolon !!!
 
Au fait lparam ça fait quoi ???


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 09-03-2002 à 17:30:06    

davidmarli a écrit a écrit :

idem missing operatoe or semicolon !!!
 
Au fait lparam ça fait quoi ???  




Moi G pas de message.... quelle ver de Delphi ?
(pas oublié 1 unité ?)


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 09-03-2002 à 17:33:31    

delphi 5  
 
Coment ça tu n'as pas de message !!!


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 09-03-2002 à 17:43:54    

Moi ça compile....
Faut que je parte @+


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 09-03-2002 à 17:45:02    

euh tu peux faire un copier coller de la procedure où tu emploi le sendmessage ....
stp
 
merci


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 09-03-2002 à 17:51:34    

bon ok, j'avais déjà une varaible nommée lparam !!!!
 
putain faut être con dans la vie. Maintenant ça compile, mais cela ne sélectionne pas l'item dans la combobox !!!
 
Pourquoi???


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 09-03-2002 à 18:13:48    

dans sendmessage, la valeur de HWND, elle correspond au hwnd de la fenetre qui contient la combobox, ou au hwnd de la combobox directement ???
 
Si c'est le deuxième cas, comment puis-je connaitre son HWND ???
 
Je ne sais pas si je suis très clair là !!


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 09-03-2002 à 21:17:05    

avec enumchildwindows ou qqchose comme ca tu peux recuperer les sous-fenetres d'une fenetre trouvée avec enumwindows
si je me souviens bien tous les combobox, editbox, etc... comptent comme des sous-fenetres


---------------
mes programmes ·· les voitures dans les films ·· apprenez à écrire
Reply

Marsh Posté le 09-03-2002 à 21:22:11    

tu dois utiliser le hwnd de ta combobox et donc faire SendMessage(NomCombo.Handle,CB_SELECTSTRING,...

Reply

Marsh Posté le 09-03-2002 à 21:26:52    

ok j'avais pas vu que tu voulais piloter un autre prog   :D  
 
ben va falloir que tu utilises ce que te dis anp

 

[jfdsdjhfuetppo]--Message édité par Taureau--[/jfdsdjhfuetppo]

Reply

Marsh Posté le 10-03-2002 à 03:35:46    

Oui étant donné qu'il peut il y avoir plusieurs combo pour 1 fenetre... par contre tu risque de te galéré pour trouver le handle du bon composant... (si je me souvient bien y a 1 API qui donne le handle du compo sous la souris... Je dis ptet 1 connerie là... j'vient de rentrer d'1 ptite fête donc....)
 :hello:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 10-03-2002 à 09:02:22    

et enumchildwindows ça fonctionne comment ?


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 10-03-2002 à 11:30:23    

ok, j'ai trouvé, tout marche nickel !!!!!
 
Encore merci beaucoup pour votre aide à tous.
 
PS : antp et Poire vous êtes étudiant, ou vous travaillez ?
Si oui dans quoi ?
 
Mes questions vous ont peut-être parue très bêtes, mais n'ayant jamais fait de prog windows, toutes ces commandes m'étaitent inconnues.
 
Encore une fois mille merci.


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 10-03-2002 à 11:31:04    

Pour le truc dont G parlé avec la souris C :  
 
ChildWindowFromPoint
The ChildWindowFromPoint function determines which, if any, of the child windows belonging to a parent window contains the specified point.  
 
HWND ChildWindowFromPoint(
 
    HWND hWndParent, // handle to parent window
    POINT Point  // structure with point coordinates
   );  
 
 
Parameters
 
hWndParent
 
Identifies the parent window.  
 
Point
 
Specifies a POINT structure that defines the client coordinates of the point to be checked.  
 
 
 
Return Values
 
If the function succeeds, the return value is the handle of the child window that contains the point, even if the child window is hidden or disabled. If the point lies outside the parent window, the return value is NULL. If the point is within the parent window but not within any child window, the return value is the handle to the parent window.  
 
Remarks
 
Windows maintains an internal list, containing the handles of the child windows associated with a parent window. The order of the handles in the list depends on the Z order of the child windows. If more than one child window contains the specified point, Windows returns the handle of the first window in the list that contains the point.  
 
See Also
 
ChildWindowFromPointEx, POINT, WindowFromPoint
 
(1001 messages posté  :D )

 

[jfdsdjhfuetppo]--Message édité par [SDF]Poire--[/jfdsdjhfuetppo]


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 10-03-2002 à 11:32:10    

merci


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 10-03-2002 à 11:40:36    

Merde j'avais pas vu que t'avais trouvé... (posté avant moi ;) ) j'allé te filer 1 exemple pour enumchildwindows  :D  
 
T questions sont loin d'être bêtes par rapport à tout ce qu'on voit ici.....
 
Sinon moi je suis étudiant en info (2e année de DUT info) et Antp bosse ds 1 PME (ds l'info aussi)
 :hello:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 10-03-2002 à 11:48:23    

ben moi je suis prof de maths et surtout passioné d'info, enfin de programmation.
 
bon ben si j'ai d'autres questions sur Delphi, je saurais à qui m'adresser!
encore une fois Merci.


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 10-03-2002 à 11:51:02    

Tu donnes pas des cours de maths pour des pov étudiants qui comprennent pas tout en maths ?:D

 

[jfdsdjhfuetppo]--Message édité par [SDF]Poire--[/jfdsdjhfuetppo]


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le 10-03-2002 à 12:33:54    

non, non, je suis prof de maths au Lycée Paul le Rolland à Drancy (93)


---------------
Matheux Fou - https://afficheur-tempo.fr - TEMPO BOX pour abonnés TEMPO EDF
Reply

Marsh Posté le 10-03-2002 à 13:45:36    

Par ce que G des ptits soucis en maths  :D


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
Reply

Marsh Posté le    

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed