Solved

Get text from a CEdit window in another process?

Posted on 2000-04-23
4
259 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 54
withoutTen challenge 14 137
mapAB Challlenge 35 174
Making an alias 7 115
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.

726 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