CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Posts
    166

    RichEdit based Win32 example

    Hi all!

    Where can I find example for using RichEdit control (mainly how to load a .rtf file and display it in the control) which based only on WIN32 (not MFC!!!)
    All the examples I have found are based on MFC...

    Thanks!!

  2. #2
    Join Date
    Mar 2009
    Location
    Riga, Latvia
    Posts
    128

    Re: RichEdit based Win32 example

    Here: http://home.perm.ru/strannik/#engl
    See Demo_1_5

    But there are some exceptions: it's not a standard C++ compiler, in English examples all identifiers are obfuscated, most of documentation is in Russian. But I've learned WinAPI on this compiler.

  3. #3
    Join Date
    Nov 2004
    Location
    Pakistan
    Posts
    466

    Re: RichEdit based Win32 example

    Make sure you load library richedit32.dll or latest version richedit20.dll before creating richedit control.

    create rich edit using simple CreateWindowEx

    Code:
    int unique_ID = WM_USER+200;
    
    //parenthwnd is assumed dialog handle
    
    hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,
    		"RICHEDIT","RichTextBox",
    		WS_TABSTOP|WS_CHILD | WS_VISIBLE,
         		100,100,300,300,
    		parenthwnd,
    		(HMENU)unique_ID,GetModuleHandle(NULL),NULL
    			);
    
    
    TCHAR * newRTF;
    
    //load entire file contents in variable newRTF;
    
    
    SETTEXTEX se;
    se.codepage = CP_ACP;
    se.flags = ST_DEFAULT;		//inSelection ? ST_SELECTION : 
    SendMessage(hwnd,EM_SETTEXTEX, (WPARAM)&se,(LPARAM)(LPTCSTR)newRTF);

    I hope it helps
    » Please 'Rate This Post' if it helped (encourage us to help you more)
    » Build GUI in minute using rad c++
    » Free IDE + GUI code generator - screenshot
    » Free WINAPI sourcecode and tutorials

  4. #4
    Join Date
    Dec 2008
    Posts
    114

    Re: RichEdit based Win32 example

    There are plenty of samples in MSDN...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured