Thread: newbie to rich edit, cant get it to work

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

    newbie to rich edit, cant get it to work

    as a newbie to the rich edit control, i want to create a simple rich edit for my chat program. The rich edit control will contain text that other people send.
    now the problem is how do i start?
    1. i use VC6++ to create a rich edit control using resource editor
    2. read on MSDN to do "LoadLibrary("riched20.dll ") ;"

    but the dialog doesnt even show up when i added the rich text control in. any idea how to start using rich edit?

    btw using visual
    - c++6.0
    - win98
    - used to API style of working
    Code:
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    	LPSTR lpCmdLine, int nCmdShow)
    {
    	WNDCLASSEX wc;
    	HWND hwnd;
    	MSG Msg;
    
    	wc.cbSize		 = sizeof(WNDCLASSEX);
    //and so on.... the styles dont matter coz i am making an invisible window that doesnt show up
    	
    
    
    	LoadLibrary("riched20.dll ") ; // I loaded library but no the dialog doesnt show up when rich edit control is added into the dialog resource
    
    	hwnd = CreateWindowEx(
    		 0,
    		"myWindowClass",
    		"The title of my window",
    		WS_OVERLAPPEDWINDOW,
    		CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
    		NULL , NULL, hInstance, NULL);
    	
    
    
    	if(hwnd == NULL)
    	{
    		MessageBox(NULL, "Window Creation Failed!", "Error!",
    			MB_ICONEXCLAMATION | MB_OK);
    		return 0;
    	}
    
    
    
    
    	while(GetMessage(&Msg, NULL, 0, 0) > 0)
    	{
    			TranslateMessage(&Msg);
    			DispatchMessage(&Msg);
    	}
    	return Msg.wParam;
    }

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    try testing that the rich edit version (ie 2.0) exists and was loaded. Your OS and complier version determine the DLL you have to load.

    HINSTANCE hRE_DLL = LoadLibrary("riched20.dll ") ;//try and load the latest version of the Rich Edit DLL (sould be inc. in Win98)
    if(hRE_DLL == NULL)//if this fails try for the old version
    hRE_DLL = LoadLibrary("riched32.dll);
    if(hRE_DLL == NULL)//if both fail handle error
    //display error and exit

    ensure the edit is visible ie has WS_VISIBLE and check what happens on creation in the WM_INITDIALOG/WM_CREATE msg.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Rich Edit Control Colors
    By mrafcho001 in forum Windows Programming
    Replies: 2
    Last Post: 07-08-2006, 04:26 PM
  2. list control and rich edit
    By eXistenZ in forum Windows Programming
    Replies: 0
    Last Post: 01-19-2005, 06:44 AM
  3. Newbie trying to work w/ KR book!?!
    By Slimcracker in forum C Programming
    Replies: 3
    Last Post: 05-01-2003, 02:04 PM
  4. Rich Edit
    By sean345 in forum Windows Programming
    Replies: 2
    Last Post: 07-22-2002, 04:35 PM
  5. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 02:12 AM