I've been trying a couple of different code samples found on the web. I must say I havn't been playing with SendMessage a lot but I was able to use it for some basic needs (exemple: a dialog box asking you to load a file: I can populate a new path and click "OK" to browse to it).
My question is concerning such a DIALOG BOX. Like I said I can make it browse to a given path. NOW I want to use GETTEXT to see in which path I currently am.
I am trying the following piece of code:
... hwndPOPUP contains the right hwnd for the dialog window that has appeared. The couple of FindWindowEx lines brings me down to the hwnd of ComboBoxEx32, which is the dropdown I'm interested into. The hwndCONTROL is correctly populated all the way. The GETTEXTLENGTH does return a value of "30", which is the exact length of the string I am interested in retrieving (confirmed by using "Window Detective").Code:hwndCONTROL = FindWindowEx(hwndPOPUP, 0&, "WorkerW", vbNullString) hwndCONTROL = FindWindowEx(hwndCONTROL, 0&, "ReBarWindow32", vbNullString) hwndCONTROL = FindWindowEx(hwndCONTROL, 0&, "Address Band Root", vbNullString) hwndCONTROL = FindWindowEx(hwndCONTROL, 0&, "msctls_progress32", vbNullString) hwndCONTROL = FindWindowEx(hwndCONTROL, 0&, "ComboBoxEx32", vbNullString) Dim strToolbarText As String Dim txtLen As Long txtLen = SendMessage(hwndCONTROL, WM_GETTEXTLENGTH, ByVal 0, ByVal 0) SendMessage hwndCONTROL, WM_GETTEXT, ByVal (txtLen + 1), ByVal StrPtr(strToolbarText)
The problem is that the next line, "GETTEXT", returns "" in my strToolBarText variable. I'm near.... but can't find what the problem is! This is a dialog box appearing from IE.
Any tips? Thank you guys!!
Krass




Reply With Quote