Solved

Get/Set WindowText questions

Posted on 1998-08-15
1
166 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 20 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand macro to ask for filename column 8 37
Tab names are off by one 5 54
changeXy challenge 13 93
moto 4g phone enable finger print 4 48
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

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