Problems with my richedit...

This is a discussion on Problems with my richedit... within the Windows Programming forums, part of the Platform Specific Boards category; Okay I got a richedit working (finally), after many hours of messing around with the code. Simple fix, long path ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    132

    Problems with my richedit...

    Okay I got a richedit working (finally), after many hours of messing around with the code. Simple fix, long path to get there. But anyways, I get no errors whatsoever now so the RichEdit should be created, right? Well wrong, I try to click in the area where this RichEdit should be and the mouse doesn't change as it should when moving over a richedit or editbox. I even resized it and gave it a border (which should have been seen because of the resizing... made it smaller then the window it was being created in) and still no sign of the thing. Any ideas? Check code below:

    Code:
    case WM_CREATE:
    			GetClientRect(hwnd, &rect);
    			swnd.CmdLine = CreateWindow("EDIT", "", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, rect.left - 1, rect.bottom - 17, rect.right + 2 - rect.left, 18, hwnd, NULL, NULL, NULL);
    			if( swnd.CmdLine == NULL ) {
    				err = GetLastError();
    				sprintf(buffer, "Couldn't create CMDLINE for status window. (%d)", err);
    				MessageBox(NULL, buffer, "Creation Error", MB_ICONERROR);
    			}
    			else {
    				swnd.Display = CreateWindowEx(WS_EX_CLIENTEDGE, chCntrlName, "RichEdit Test", WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, rect.left + 15, rect.top + 15, rect.left - rect.right - 30, rect.bottom - rect.top - 30, hwnd, (HMENU)IDC_MYRICHEDIT, NULL, NULL);
    //				swnd.Display = CreateWindowEx(WS_EX_CLIENTEDGE, chCntrlName, "", WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, rect.left - 1, rect.top - 1, rect.left - rect.right + 2, rect.bottom - 17 - rect.top , hwnd, (HMENU)IDC_MYRICHEDIT, NULL, NULL);
    				if( swnd.Display == NULL ) {
    					err = GetLastError();
    					sprintf(buffer, "Couldn't create DISPLAY for status window. (%d)", err);
    					MessageBox(NULL, buffer, "Creation Error", MB_ICONERROR);
    				}
    				else {
    					ShowWindow(swnd.Display, SW_SHOW);
    					StatusReady = TRUE;
    					MessageBox(NULL, TEXT("RichEdit Control for Status Window created."), TEXT("Creation Success!"), MB_OK);
    					AppendText(swnd.hWnd, COLOR_DK_GREEN, "Testing!");
    //					SetWindowText(swnd.Display, "Testing!");
    //					SetWindowText(swnd.Display, "Testing a second time.");
    				}
    			}
    			break;
    The above code is the WM_CREATE message of the window the RichEdit is being created in. (This is an MDI interface, btw.) The DLL is already properly loaded (riched20.dll) which doesn't return any errors upon started and so it should be loaded properly. I do end up receiving the "RichEdit Control for Status Window created." message everytime the program starts and so I don't know how it shouldn't be there. If you can help me out with this one I would be greatly appreciative!

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Code:
    rect.left - rect.right + 2
    I think you want this the other way around! Also use an hInstance for compatibility with Win9x.

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    132
    Thanks! I can't believe I didn't notice that before. But that always seems to be the way with me, find the simplest solution to my "bugs" and you fix them. Oh well!

    And I added the hInstance but I know for a fact that the program wont be running on a win9x system.

    Tyouk

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 03:59 AM
  2. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 01:17 PM
  3. Drawing on a RichEdit?
    By Sea Monster in forum Windows Programming
    Replies: 5
    Last Post: 12-30-2003, 02:17 PM
  4. multiline richedit scrolling issue
    By tyouk in forum Windows Programming
    Replies: 1
    Last Post: 11-03-2003, 05:59 AM
  5. RichEdit Problem
    By dirkduck in forum Windows Programming
    Replies: 0
    Last Post: 07-24-2003, 06:50 PM

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