Results 1 to 9 of 9

Thread: Editbox

  1. #1

    Thread Starter
    Lively Member FantastichenEin's Avatar
    Join Date
    Mar 2000
    Location
    dairy
    Posts
    106

    Editbox

    I have created a window with an EditBox on it.
    I want to create a function that appends the EditBox text with a line of text.
    I currently have the following.

    PHP Code:
    void OutputDebug(char *text)
    {
      
    SendMessage(hwndEditWM_SETTEXT0
                 (
    LPARAMtext); 

    The above code overwrites what is already in the EditBox.
    How do I append it?
    Thanks
    ****

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    PHP Code:
    void OutputDebug(char *text)
    {
      
    char bigbuffer[1000];
      
    SendMessage(hwndEditWM_GETTEXT1000
                 (
    LPARAMbigbuffer); 
      
    strcat(bigbuffertext);
      
    SendMessage(hwndEditWM_SETTEXT0
                 (
    LPARAMbigbuffer); 

    I think...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    jim mcnamara
    Guest
    Call SendMessage with WM_GETTEXT first to return the box's text. Concatenate the two strings, then call WM_SETTEXT to set the new string back into the box.

  4. #4
    jim mcnamara
    Guest
    Woops! CB got there first!

    IF you're writing some kind of logger or debug window, be aware that textboxes have a limit on text string length - 32767 chars including the null-terminator.

  5. #5

    Thread Starter
    Lively Member FantastichenEin's Avatar
    Join Date
    Mar 2000
    Location
    dairy
    Posts
    106
    Thanks - I did think of using a buffer but I thought there might be a more efficient way.
    ****

  6. #6

    Thread Starter
    Lively Member FantastichenEin's Avatar
    Join Date
    Mar 2000
    Location
    dairy
    Posts
    106
    Originally posted by jim mcnamara
    IF you're writing some kind of logger or debug window, be aware that textboxes have a limit on text string length - 32767 chars including the null-terminator.
    Thanks for this info
    ****

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I don't think so. You can save space and sacrifice speed by using WM_GETTEXTLENGTH and strlen(text) to calculate the needed size of bigbuffer and dynamically allocate it.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8
    jim mcnamara
    Guest
    No. Missed communication.

    I thought I was warning him about trying to put too long a string in the editbox, not how to allocate string memory. Issuing this warning was a result of concluding from the fact that his function was named OutputDebug, therefore, he would be streaming output to the box. I could be wrong.

    And it really matters little.

  9. #9
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Thanks - I did think of using a buffer but I thought there might be a more efficient way.
    I hit reply just after this post...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width