Solved

Get text from a CEdit window in another process?

Posted on 2000-04-23
4
252 Views
Last Modified: 2013-11-20
Is there any way to get the text contained in a CEdit window belonging to another process, given its HWND?
0
Comment
Question by:Further
4 Comments
 

Accepted Solution

by:
pkkn earned 50 total points
ID: 2743142
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
 
LVL 6

Expert Comment

by:MichaelS
ID: 2743181
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
 
LVL 3

Expert Comment

by:altena
ID: 2745266
Why would you ever want to do this?
0
 

Author Comment

by:Further
ID: 2746219
Thanks!  That's funny that WM_GETTEXT works but GetWindowText() doesn't :)

Yay for Microsoft
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now