cs_Chewba
Messages postés90Date d'inscriptionjeudi 16 mai 2002StatutMembreDernière intervention10 septembre 2006
-
18 août 2003 à 19:47
cs_Chewba
Messages postés90Date d'inscriptionjeudi 16 mai 2002StatutMembreDernière intervention10 septembre 2006
-
20 août 2003 à 14:52
Bonjour à tous,
Je voudrais pouvoir récupérer les infos dans la status text d'internet explorer...
Comment puis-je faire ?
ShareVB
Messages postés2676Date d'inscriptionvendredi 28 juin 2002StatutMembreDernière intervention13 janvier 201626 19 août 2003 à 09:20
salut
la je pense qu'il faut passer par les apis :
static oldstatus as string
hwnd = findwindow("IEFrame",byval 0&)
hwndstatus = findwindowex(hwnd,byval 0&,"msctls_statusbar32",byval 0&)
statustext = space(255)
error = sendmessage(hwndstatus,WM_GETTEXT,byval 255&,byval strptr(statustext)
statustext = mid$(statustext,1,instr(statustext,vbnullchar)-1)
if oldstatus = statustext then
'on ne le log pas
else
oldstatus = statustext
'on le log
end if
tu mets ca en boucle dans un timer et ca te log tout le texte du status
pour les declarations d'apis tu les trouves sur la visionneuse d'APIs
ShareVB
Messages postés2676Date d'inscriptionvendredi 28 juin 2002StatutMembreDernière intervention13 janvier 201626 20 août 2003 à 09:52
salut
oui j'avais pas testé :
ce code marche (les erreurs proviennent de la déclaration des apis et de strptr)
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) 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 Long) As Long
Private Const WM_GETTEXT = &HD
Private Sub Timer1_Timer()
Dim hwnd As Long, hwndstatus As Long, statustext As String, error As Long
Static oldstatus As String
hwnd = FindWindow("IEFrame", ByVal 0&)
hwndstatus = FindWindowEx(hwnd, ByVal 0&, "msctls_statusbar32", ByVal 0&)
statustext = Space(254) & vbNullChar
error = SendMessage(hwndstatus, WM_GETTEXT, ByVal 255&, ByVal statustext)
statustext = Mid$(statustext, 1, InStr(statustext, vbNullChar) - 1)
If oldstatus = statustext Then
'on ne le log pas
Else
oldstatus = statustext
'on le log
Debug.Print "log"
End If
End Sub
cs_Chewba
Messages postés90Date d'inscriptionjeudi 16 mai 2002StatutMembreDernière intervention10 septembre 2006 20 août 2003 à 14:52
Merci, cela fonctionne...
En fait, l'erreur venait de strptr comme tu le dis car j'avais déclaré les API convenablement mais cela bloquait au niveau de strptr...
Encore merci pour ton aide...