Text aus einem Edit Control in einem fremden Programm
-
Moin!
Windows XP
Ms Visual Studio .net ver. 2003
Ich weiß irgendwann kam diese Frage schonmal, aber ich finde den Thread über die Suche nicht mehr. Also könnt ihr mir verraten, wie ich an den Text eines Edit Control in einem fremden Programm komme. GetWindowText funktioniert ja nicht ("This function cannot retrieve the text of an edit control in another application.")!
mfg killsmaker
-
Büdde:
#include <Windows.h> #include <String> using std::string; string& GetCaptionPart(HWND hWnd, long lCharCounts = 0L) { static string strReturn; long lLength; if(lCharCounts <= 0L) // den gesamten Text ermitteln lLength = SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0L); else lLength = lCharCounts; PTCHAR pszCaption; pszCaption = new TCHAR[lLength + 1L]; SendMessage(hWnd, WM_GETTEXT, lLength, reinterpret_cast<LPARAM>(pszCaption)); strReturn = pszCaption; delete [] pszCaption; return (strReturn); }