Link to home
Start Free TrialLog in
Avatar of Jothanin
Jothanin

asked on

Get/Set WindowText questions

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?
ASKER CERTIFIED SOLUTION
Avatar of erajoj
erajoj
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial