Solved

Get/Set WindowText questions

Posted on 1998-08-15
1
163 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 20 total points
Comment Utility
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 improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

8 Experts available now in Live!

Get 1:1 Help Now