Thread: rich edit 4.1 is giving me a head-ache

  1. #1
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685

    rich edit 4.1 is giving me a head-ache

    I am having some trouble here. My code will work fine using rich edit 3.0 but when I try and go with 4.1 the edit control won't be created. Here is the general idea of my code:

    Code:
    WORD GetRichEditVersion(void) {
    	static WORD wRichVersion = NO_RICH;
    
    	// this will keep the program from opening multipile instances
    	// of the correct rich edit dll.
    	if(!wRichVersion) {
    		if(!LoadLibrary(TEXT("Msftedit.dll"))) {
    			if(!LoadLibrary(TEXT("Riched20.dll"))) {
    				if(LoadLibrary(TEXT("Riched32.dll")))
    					wRichVersion = RICH_1_0;
    			} else
    				wRichVersion = RICH_2_0;
    		} else
    			wRichVersion = RICH_4_1;
    	}
    
    	return wRichVersion;
    }
    
    	/* Meanwhile, elsewhere in my program (in WM_CREATE to be exact) */
    	WORD wRichEditVersion = GetRichEditVersion();
    	if(wRichEditVersion)
    		if(wRichEditVersion) == RICH_1_0)
    			hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
    	 			TEXT("RichEdit"), TEXT(""),
    				WS_VISIBLE | WS_CHILD | WS_BORDER | ES_MULTILINE,
    				half, area.top, half, area.bottom,
    				hwndParent, (HMENU)(ID_REDIT), hInst, NULL);
    		else
    			hwndEdit = CreateWindow(
    	 			RICHEDIT_CLASS, TEXT(""),
    				WS_VISIBLE | WS_CHILD | WS_BORDER | ES_MULTILINE,
    				half, area.top, half, area.bottom,
    				hwndParent, (HMENU)(ID_REDIT), hInst, NULL);
    	else
    		hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
     				WC_EDIT, TEXT(""),
    				WS_VISIBLE | WS_CHILD | WS_BORDER | ES_MULTILINE,
    				half, area.top, half, area.bottom,
    				hwndParent, (HMENU)(ID_REDIT), hInst, NULL);
    	/* more code...*/
    Okay, GetRichEditVersion() determines the version as anyone can plainly see. If I don't attempt to load msftedit.dll I can get a rich edit 3.0 control up and running, however, when I do use msftedit.dll I won't get an edit control. Can anyone set me straight here?

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    It amazes me that given all the documentation there is out there this problem wasn't easier to solve. I was looking through richedit.h and found that I should be using MSFTEDIT_CLASS for my class name not RICHEDIT_CLASS. Maybe this will help someone else someday.

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    4
    Hi, can you help me. Also, I have problem with RichEdit 4.1 in Visual C++ 6.0.

    How can I Create RichEdit 4.1, use the Justify Alignment and hyphenate some words on the end of the line?

    Thanks, Goran

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Please don't post in threads that have been dormant for a long time. A copy of the forum rules can be found here:

    http://cboard.cprogramming.com/annou...ouncementid=51

    Please create a new thread for your question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question about a working linked list
    By cold_dog in forum C++ Programming
    Replies: 23
    Last Post: 09-13-2006, 01:00 AM
  2. Rich edit
    By Garfield in forum Windows Programming
    Replies: 10
    Last Post: 07-10-2002, 04:08 PM
  3. Rich Edit
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 06-02-2002, 10:42 AM
  4. colorful rich text edit boxes
    By master5001 in forum Windows Programming
    Replies: 0
    Last Post: 11-26-2001, 11:52 AM
  5. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 02:12 AM