Edit probs

This is a discussion on Edit probs within the Windows Programming forums, part of the Platform Specific Boards category; hi, wonder if all you clever peeps can solve this prob you prob can.right i wanna no how to automatically ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    35

    Edit probs

    hi,
    wonder if all you clever peeps can solve this prob you prob can.right i wanna no how to automatically scroll down a edit box because when i set the text it scrolls to top :/

    Code:
    void OutputTextToScreen(char *p)
    {
         szBuffer2.append(p);
         SetWindowText((HWND)hConsole, szBuffer2.c_str());
         SendMessage((HWND)hConsole,EM_SETSEL,0,0);
         SendMessage((HWND)hConsole,EM_SCROLLCARET,0,0);
    }
    tell me if im doing nething wrong
    thx in advance
    Theres a sucker born every minute, but a swallower is harder to find

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    I have found that you can scroll around to any part as long as you know the charector you wish to scroll about. Here is how to make a selection:
    An application sends an EM_SETSEL message to select a range of characters in an edit control.

    EM_SETSEL
    wParam = (WPARAM) (INT) nStart; // starting position
    lParam = (LPARAM) (INT) nEnd; // ending position


    Parameters

    nStart

    Value of wParam. Specifies the starting character position of the selection.

    nEnd

    Specifies the ending character position of the selection.

    Return Values

    This message does not return a value.
    What you do is make both the starting and ending position the same and it will scroll the caret and screen to that position. This is what I have always used in the past.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    35

    Talking :D

    yep it work thx alot
    Theres a sucker born every minute, but a swallower is harder to find

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (Multiline) Edit Control Limit
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-17-2008, 12:56 PM
  2. line number on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-18-2008, 07:58 AM
  3. WS_HSCROLL in ES_READONLY edit box error
    By Homunculus in forum Windows Programming
    Replies: 4
    Last Post: 02-13-2006, 08:46 AM
  4. Multiline Edit Box Parser
    By The Brain in forum Windows Programming
    Replies: 6
    Last Post: 11-01-2005, 07:15 PM
  5. Replies: 3
    Last Post: 07-23-2005, 09:00 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21