prova questo (ti dava l'errore perchè non trovava l'API FindWindowEx nella User32, ora ho provato a passargli l'handle di un form e non dà più errori del genere).
ho modificato anche il tipo della variabile che gli passi perchè l'handle può essere maggiore di quello che vb6 considera un intero.
Altra soluzione sarebbe tramite Il programma Microsoft Spy++ andare a ricavarti il nome del controllo che usano loro. però come dici tu, se te lo cambiano tutte le volte sei punto e a capo.codice:Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long 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 Const WM_GETTEXTLENGTH As Integer = &HE Private Const WM_GETTEXT As Integer = &HD Public Function getChromeUrl(winHandle As Long) As String Const nChars As Integer = 256 Dim browserUrl As String Dim urlHandle As Integer Dim b As String Dim length As Integer browserUrl = "" length = SendMessage(urlHandle, WM_GETTEXTLENGTH, 0, 0) urlHandle = FindWindowEx(winHandle, 0, "Chrome_AutocompleteEditView", "") If length > 0 Then b = String(nChars, " ") SendMessage urlHandle, WM_GETTEXT, nChars, b browserUrl = b End If getChromeUrl = browserUrl End Function

Rispondi quotando