?
Solved

Get/Set WindowText questions

Posted on 1998-08-15
1
Medium Priority
?
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

718 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