Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 29th, 2007, 5:33 PM   #1
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4 Brent is on a distinguished road
WIN32 API - Appending text in an EDIT box

I was wondering if there is a WINAPI function that allows you to append text to text that is already in an EDIT box, or would I have to create my own function to do this? thanks for any help.

Im using Dev C++ on Win XP.


brent
Brent is offline   Reply With Quote
Old May 29th, 2007, 5:44 PM   #2
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 852
Rep Power: 4 The Dark is on a distinguished road
You can use the EM_REPLACESEL message after setting the caret to the end of the edit control using EM_SETSEL (I think start of -1 and end of 0 does it, but I can't remember for sure).
The Dark is offline   Reply With Quote
Old May 31st, 2007, 8:50 PM   #3
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4 Brent is on a distinguished road
Alright, thanks i'll try that and see how it works out.
Brent is offline   Reply With Quote
Old Jun 1st, 2007, 7:21 PM   #4
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4 Brent is on a distinguished road
The Dark, your idea worked great, but another problem popped up. Whenever I click the Edit box, the program exits. What could be causing this.
Brent is offline   Reply With Quote
Old Jun 1st, 2007, 7:31 PM   #5
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 852
Rep Power: 4 The Dark is on a distinguished road
Without looking at your code, I have no idea, sorry.
The Dark is offline   Reply With Quote
Old Jun 1st, 2007, 9:12 PM   #6
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4 Brent is on a distinguished road
Yea, my bad, I dont have the code with me at the moment but I will post it.
Brent is offline   Reply With Quote
Old Jun 2nd, 2007, 5:55 AM   #7
Eoin
Hobbyist Programmer
 
Eoin's Avatar
 
Join Date: Jun 2006
Location: Ireland
Posts: 152
Rep Power: 3 Eoin is on a distinguished road
Completely random stab in the dark... Might you be missing a break statement such that the code which handles a left click runs on into a block for handling close messages or something similar?
__________________
Visit my website BinaryNotions.
Eoin is offline   Reply With Quote
Old Jun 2nd, 2007, 9:37 PM   #8
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4 Brent is on a distinguished road
Hmmm, thats interesting, i'll take a look at my code.
Brent is offline   Reply With Quote
Old Jun 3rd, 2007, 11:46 AM   #9
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4 Brent is on a distinguished road
Ok, I have checked the code over and I didnt see any missing breaks, and I have attached the source for anyone who wants to take a look.
Attached Files
File Type: zip code.zip (3.0 KB, 21 views)
Brent is offline   Reply With Quote
Old Jun 3rd, 2007, 8:11 PM   #10
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 852
Rep Power: 4 The Dark is on a distinguished road
I can't run through your code without the resource.h file (and the other resource files), but here are a few suspicious items:
1.
    SendDlgItemMessage(hwnd,IDC_ALL_MSG_BOX,EM_SETSEL,-1,(LPARAM)-1);
You are sending this dialog message in the "default" case when you receive a dialog message. Possibly this would end up causing an infinite recursion, as you might receive a dialog message in response to this dialog item message.

2.
          return NOT;
The documentation I read says either return TRUE or FALSE to a dialog message, I'm not sure why you are returning 2 (which would probably be the same as returning TRUE)

3.
          for(a=0;a<=sizeof(new_name);a++)
sizeof(new_name) returns exactly 4 in a 32 bit environment. You need to use strlen to find the length of a string.


Other than that, I can only suggest running the program through a debugger, setting a breakpoint on the EM_REPLACESEL lines and stepping through from there.
The Dark is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OnlineTextEditor.Com! Sane Show Off Your Open Source Projects 43 Jun 16th, 2006 8:55 AM
text edit field in Win32 app. badbasser98 C++ 6 Jan 9th, 2006 7:12 AM
How to detect cursor location and insert text??? syntax-error C# 3 Jun 30th, 2005 1:42 AM
edit a text file ojschubert Sed and Awk 2 Apr 18th, 2005 8:28 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:24 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC