Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get/Set WindowText questions

Posted on 1998-08-15
1
Medium Priority
?
170 Views
Last Modified: 2013-11-20
Part of my program has to get information from a dialog box and format and display the information into the current document.  This is easy using SetWindowText().  The only problem is that I must create an obsurd number of CStrings in the formatting process and I get memory reading errors.  If the answer is use GetWindowText, what kind of type declaration should be used for the buffer that will hold the window's text?  Is there a better way to do this?  Also, is there a way to GetWindowText relative to the cursor so something could be displayed at the cursor location.  

Example:

CString fubar = GetWindowTextBeforeCursor();
CString  marsupial = "text";
CString foo = GetWindowTextAfterCursor();
CString alltogethernow = fubar + marsupial + foo;
SetWindowText(alltogethernow);

Is there any way to do this?
0
Comment
Question by:Jothanin
1 Comment
 
LVL 4

Accepted Solution

by:
erajoj earned 60 total points
ID: 1320871
Hi,
If it's an editbox you're referring to, then just use ReplaceSel in this case:

  pEdit1->ReplaceSel( "text" );

/// John
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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…
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.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

885 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