Thread: Unable to format text in a RichEdit, not using MFC

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    162

    Unhappy Unable to format text in a RichEdit, not using MFC

    Hi, all

    I have created a RichEdit box (version 1.0) using regular windows API (no MFC) but I can’t seem to format (using the SendMessage() function) any part of the text in the control. I have tested both formatting the paragraphs (PARAMFORMAT structure) and characters (CHARFORMAT structure) but nothing seems to get displayed. The return values (from both EM_SETPARAFORMAT and EM_SETCHARFORMAT flags) are nonzero, which indicates success. I know that I am setting the cbSize and the dwMask structure members correctly because after setting the format, I use EM_GETPARAFORMAT and EM_GETCHARFORMAT flags to check if the changes was actually made, and it is (but just not displayed). This experience is really strange, I really don’t know what I am doing wrong or missing. And I can’t seem to find any examples on formatting text in a Rich Edit without using MFC. Any ideas on how to solve this or find any examples are greatly appreciated.

    Thanks in advance
    Last edited by Aidman; 08-03-2003 at 04:23 PM.
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

  2. #2
    Registered User
    Join Date
    Dec 2002
    Posts
    162
    hehe... I found the problem, when I declared the PARAMFORMAT and the CHARMFORMAT structures I forgot setting them to zero, which caused the variable members (who wasn’t later set to any specific value) to have unpredictable values. Anyways it was a clumsy mistake
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting text to PDU format
    By skye in forum C Programming
    Replies: 3
    Last Post: 02-06-2002, 11:14 PM
  2. Validating the contents of a char buffer
    By mattz in forum C Programming
    Replies: 3
    Last Post: 12-09-2001, 06:21 PM
  3. Moving to the next structure array
    By mattz in forum C Programming
    Replies: 2
    Last Post: 11-30-2001, 03:43 PM
  4. Structure problem
    By mattz in forum C Programming
    Replies: 10
    Last Post: 11-30-2001, 01:19 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM