-
I got a few problems...
What do you do when you use a GetText Function to get the text on a window and nothing comes back? Like you know for a fact your code is right and bug free. I thinking the window has something blocking API or something. Some windows and objects dont let you use API on them is that possible? Some windows/objects you can't hide. Like Ad bars that dock on ur computer and stuff. How can you hide em? Also I know of one window i have you can SEE it has a title bar and a caption in it, but an API spy can get it's caption.
- How do you get around all of this? -
- How can I hide the windows i want to hide, and get text from objects that have text in em like a text box or maybe password box, or even a label, and captions? -
Maybe theres something I would use instad of API??
Please help...
My GetText Function:
Code:
Public Function GetText(WindowHandle As Long) As String
Dim TheText As String, TL As Long
TL = SendMessageLong(WindowHandle, WM_GETTEXTLENGTH, 0&, 0&)
TheText = String(TL + 1, " ")
Call SendMessageByString(WindowHandle, WM_GETTEXT, TL + 1, TheText)
TheText = Left(TheText, TL)
GetText$ = TheText
End Function
-
Corrected Code:
1. GetText shouldn't have a $ next to it-it is already a string.
2. Sendmessagelong? That never existed, so use Sendmessage.
Code:
Public Function GetText(WindowHandle As Long) As String
Dim TheText As String, TL As Long
TL = SendMessage(WindowHandle, WM_GETTEXTLENGTH, 0&, 0&)
TheText = String(TL + 1, " ")
Call SendMessage(WindowHandle, WM_GETTEXT, TL + 1, TheText)
TheText = Left(TheText, TL)
GetText = TheText
End Function
-
Sorry about the misunderstanding.
Do you want to get the window's Text?
You should use this instead:
Code:
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long _
, lpString As String, ByVal cch As Long) As Long
Public Function GetText(WindowHandle As Long) As String
Dim TheText As String, TL As Long
TL = GetWindowTextLength (WindleHandle)
TheText = String(TL + 1, " ")
Call GetWindowText (WindleHandle, TheText, TL + 1)
GetText = TheText
End Function
:) :eek: :( :eek: :)
-
The GetText code works, i know for a fact it does.
just gotta have this stuff:
Code:
Public Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
that $ dosn't really mater..
It's like no nody knows this stuff, its getting no replys..
Common i know someone knows what i'm looking for out there!!
-
No i don't just want to get a windows text. Read what i said before. Thats just the code i use sometimes. I don't even know really i put the code on there.
-
Code:
Public Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, [ByVal]- lParam As String) As Long
I know that!
The $ would just cost you an extra byte.
Oh, and you forgot that ByVal passes a varible BY VALUE, meaning that it cannot change the actually value.
Happy now? Obviuously, API Viewer...*_*
-
Urrr...
Could you not say that I don't know everything without posting everything?
Obviously, if you haven't posted this, how would I know what happened? No offense.