) and causing the program to hang for a long time, you can use the SendMessageTimeout(.) function instead. So, my conclusion is: try to use WM_GETTEXT message instead of GetWindowText.Ī little bit more Tips, if you are worried about being blocked when using SendMessage(hwnd, WM_GETTEXT. WM_GETTEXT message directly instead of calling Auto) static extern int GetWindowTextLength(IntPtr hWnd) public static void. Private Shared Function GetWindowTextLength(ByVal hWnd As IntPtr) As Integer End Function When your program wants to get the title of a certain control of another process (such as the content of EDIT), calling GetWindowText function often gets empty, because when you call this function on the window of another process, the system directly returns CreateWindow (Ex) The content in the reserved space, but the title of the windows control does not exist in this space. I tried it myself and the string has got nothing in it. However, recently Ive had reports saying that its not getting the string under windows 2000. For windows created with CreateWindow/CreateWindowEx, the system will store the window title in an address in the program space for windows controls, it is more common for the control to manage its title (or content) by itself. Hi, I have implemented some code earlier, using GetWindowText(CString) to get the data entered in the CEdit control. There are generally two ways to get the window title (or the content of the EDIT Control): 1.
0 Comments
Leave a Reply. |