Thread: Need help intercepting the buffer

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    17

    Need help intercepting the buffer

    Hi All,

    I am modifying an open source text editor for use in our test department. We have script files that are a nightmare to interpret and create. I want to modify a text editor to display and write too a readible format, while maintaining the integrity of the file. (Yes, I know I could do this with Python or something, but this is a good chance for me to learn C.)

    When I opened up the hood of the program I expected to find a function that does the "Oh, this is a Carriage Return, we dont want to display a character, so send a new line" which I could tweak. Instead its all done magically with SendMessage(blah, blah, blah).

    It looks like the only way to do this is to intercept the buffer before it is sent as an event, and see if the character I am looking for is there, and change the buffer accordingly.

    Does that make sense? If so, how do I recognize an "OnKeyPress" event so that I can grab the buffer? and will this constant scanning of the buffer make it so slow its not viable?

    Thanks for your thoughts.
    -Josh

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    17

    Lightbulb

    On the off chance that anyone is interested, I had a flash of inspiration last night, but its sort of a hack.

    Im setting up the keystrokes Im looking for as Accelerators in the resource file.

    Id still rather do it the "right way", whatever that is, but it should work.

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    A sample of subclassing the edit control to intercept characters was shown in this recent thread:
    http://cboard.cprogramming.com/showt...threadid=50657

  4. #4
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    By any chance, is this open source text editor Scite?

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    17
    No, Its NoteXPad. Its a pretty good little engine.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  2. writing a pack-style function, any advices?
    By isaac_s in forum C Programming
    Replies: 10
    Last Post: 07-08-2006, 08:09 PM
  3. buffer contents swapping
    By daluu in forum C++ Programming
    Replies: 7
    Last Post: 10-14-2004, 02:34 PM
  4. Tetris Questions
    By KneeGrow in forum Game Programming
    Replies: 19
    Last Post: 10-28-2003, 11:12 PM
  5. Console Screen Buffer
    By GaPe in forum Windows Programming
    Replies: 0
    Last Post: 02-06-2003, 05:15 AM