[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

Get text from a CEdit window in another process?

Is there any way to get the text contained in a CEdit window belonging to another process, given its HWND?
0
Further
Asked:
Further
1 Solution
 
pkknCommented:
Hai Further,

if you have the HWND, try the following lines of code to get the text from that window
 
char lpClassName[255];
if (::GetClassName(HWND,lpClassName, 255))
{
CString strWndClass
strWndClass = lpClassName;
if (0 == strWndClass.CompareNoCase("EDIT"))
{
CString strWindowText;
char szText[255];
::SendMessage(HWND, WM_GETTEXT, 255, (LPARAM)szText);
strWindowText = szText;
}

}
0
 
MichaelSCommented:
As I know you have to inject into target process, get the text and transfer it to yours. You can use hook for that. Let me know if you will go this way and need addition information.
0
 
altenaCommented:
Why would you ever want to do this?
0
 
FurtherAuthor Commented:
Thanks!  That's funny that WM_GETTEXT works but GetWindowText() doesn't :)

Yay for Microsoft
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now