Hi, im using C#.
I handle a window by this code line:
child = FindWindowEx(Parent, IntPtr.Zero, "DirectUIHWND");
This window is belong to "DirectUIHWND" class and it have textBox.
Im trying to get this text from textBox.
I've tryed the next function:
int winText = GetWindowText((int)child, strBldr, strBldr.Capacity);
But this function return the capture and not the text from the searchBox.
Any idea how can i get the text from the handle window?
Loading
Sam HobbsPosted Apr 3, 2012, 8:00 AM
If you search for DirectUIHWND you will find discussions from others that have tried to do things with windows of that type. It is not easy. I cannot help you. You can search the MSDN and/or the internet for information about DirectUIHWND but what you will find is technical and complicated.
Marco PoloPosted Apr 3, 2012, 6:45 AM
I haven't window with "edit" class name.
Im trying to get the text of window explorer search box.
When i type word in the search box i can see that "CabinetWClass" become to active window.
Then im going down in the tree: "WorkerW" --> "ReBarWindow32" --> "UniversalSearchBand" --> "Search Box" --> "SearchEditBoxWrapperClass" --> "DirectUIHWND".
The only class from this path that close to "edit" class it "SearchEditBoxWrapperClass" but in this class the control ID is also 0.
This class is the control im looking for?
Sam HobbsPosted Apr 3, 2012, 6:03 AM
You need to get the control id of the textbox; as I said, it is actually an edit control. Use Spy++ to get the properties of the textbox. When you do that, the Class Name will be "edit" as in the following:
The control id of that control is what you need to use in the GetDlgItem.
Marco PoloPosted Apr 3, 2012, 5:13 AM
I've tryed to put this ID at GetDlgItem function:
const int ctrID = 00000000;
It's normal to get this ID?
Sam HobbsPosted Apr 2, 2012, 1:29 PM
I think you cannot use GetWindowText for that. I know you can send a WM_GETTEXT message to do that. Except you must send the message to the TextBox; actually it is an "edit" control. You are using the edit control's parent.
Yo can use Spy++ to determine the control id of the edit control. You do that once while developing the application. Then in the program use GetDlgItem to get the edit control, then send a WM_GETTEXTLENGTH message to get the text length then create a StringBuilder object then send a WM_GETTEXT message. See the following for some relevant code:
Do you know how to use Spy++? Note that you can execute it using the VS Tools menu. However you might have to get find the 64-bit version and use it.