Utilisation des API windows problème

Résolu
fg85 Messages postés 370 Date d'inscription dimanche 28 mars 2004 Statut Membre Dernière intervention 13 avril 2007 - 16 janv. 2005 à 12:23
cs_CanisLupus Messages postés 3757 Date d'inscription mardi 23 septembre 2003 Statut Membre Dernière intervention 13 mars 2006 - 16 janv. 2005 à 13:53
Voila , j'ai crée un programme qui permet de changer le texte du bouton démmarrer sous windows XP. Il me faudrait maintenant récuperer ce texte, il faut que j'utilise la fonction "GetWindowText" mais le problème c'est que je suis un débutant en vb et si quelqu'un pouvait me mettre sur la voi se serait cool .

Voici la fonction :

Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal nMaxCount As Integer) As Integer
Dim HwndWin As Long
'Obtenir le handle
HwndWin = FindWindow("Shell_TrayWnd", "")
HwndWin = FindWindowEx(HwndWin, 0, "BUTTON", 0)

D'après ce que donc je cherche le handle du menu démarrer, je l'ajoute et j'ajoute oci nMaxCount, ensuite il doit me sortit "démarrer' normalement mais cela ne fonctionne pas.

Voici la page de microsoft : http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/getwindowtext.asp?frame=true

Grand merci à mon sauveur !!!

------------------------------------
http://fg.logiciel.free.fr

4 réponses

fg85 Messages postés 370 Date d'inscription dimanche 28 mars 2004 Statut Membre Dernière intervention 13 avril 2007
16 janv. 2005 à 13:46
Non je ne suis pas sur .NET mais sur vb6 :-(
http://fg.logiciel.free.fr
3
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
16 janv. 2005 à 13:02
est-ce que tu es en .NET ?

Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" _
(ByVal hwnd As Long) As Long

Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long


Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long

Private Sub Command1_Click()
Dim HwndWin As Long
Dim lg As Long
Dim ch As String
HwndWin = FindWindow("Shell_TrayWnd", vbNullString)
HwndWin = FindWindowEx(HwndWin, 0, "BUTTON", vbNullString)
lg = GetWindowTextLength(HwndWin) + 1
ch = Space$(lg)
GetWindowText HwndWin, ch, lg
MsgBox ch

End Sub

Daniel
0
fg85 Messages postés 370 Date d'inscription dimanche 28 mars 2004 Statut Membre Dernière intervention 13 avril 2007
16 janv. 2005 à 13:48
Merci ça fonctionne !!!
http://fg.logiciel.free.fr
0
cs_CanisLupus Messages postés 3757 Date d'inscription mardi 23 septembre 2003 Statut Membre Dernière intervention 13 mars 2006 21
16 janv. 2005 à 13:53
Salut,

Si tu sais le changer, tu devrais savoir comment le récupérer, je ne comprend pas.

Cordialement, CanisLupus
0
Rejoignez-nous