Results 1 to 6 of 6

Thread: VB6 Real Unicode Display in Rich Edit without installing RICHTX32.OCX

  1. #1

    Thread Starter
    Fanatic Member Flashbond's Avatar
    Join Date
    Jan 2013
    Location
    Istanbul
    Posts
    646

    VB6 Real Unicode Display in Rich Edit without installing RICHTX32.OCX

    Hi Guys!

    I combined two nice features for a part of my project and I decided to share it with you. Well, I had three challanges when I was doing this:

    1. Use a RichTextBox for unicode display;
    2. Use real unicode characters like superscript numbers (not fake offsets)
    3. Not to use a setup which is nearly a must if you are using RichTextBox control to copy and register RICHTX32.OCX file. (because my project was only 380KB which looks stupid for a setup.)

    Infact, I did a very small part of the job. This is a nice combination of two different modules written by some other hardworking people.

    After a long research dilettante suggested me this project to display real unicode contents RTB Superscript.zip‎. It is written only "Superscript" but it does a quite well job with unicodes, too... However, only compatible with RichText Box object...

    At first I was very happy with this but then I realized that it causes error on computers which has no RICHTX32.OCX file in System 32 folder.
    I sworn my not to use setup for a 380KB project.

    Then in another thread ,again dilettante, suggested me a code (Naked RichEdit.zip‎) which draws it's own RichTextBox which is only depending on "riched20.dll", nearly found in any PC.

    Then I made some tweaks, modifications and combined them, droped some notes into code to help for some basic features.

    And TA-TAA:

    Real Unicode Display without RICHTX32.OCX.zip !!!

    I hope someone will find it useful, too...


    PS: If anybody knows how to change the font in the code, please do let me know
    Last edited by Flashbond; Feb 9th, 2013 at 09:42 AM.

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Real Unicode Display in RichTextBox without RICHTX32.OCX

    Hi! Check out Unicode RichEdit (don't support Pictures)!

    You can change the font used for all characters by sending the WM_SETFONT message. To set the font for any or all characters, use the EM_SETCHARFORMAT message.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  3. #3

    Thread Starter
    Fanatic Member Flashbond's Avatar
    Join Date
    Jan 2013
    Location
    Istanbul
    Posts
    646

    Re: Real Unicode Display in RichTextBox without RICHTX32.OCX

    I didn't get it, can you give a sample fragment? For example, for Arial?

    By the way, despite it is a very powerful tool for text editting; it needs much much much more modification for simple usage.

  4. #4
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: VB6 Real Unicode Display in RichTextBox without installing RICHTX32.OCX

    I think there's a thread here in the CodeBank that deals with the RTB. It contains a lot of tips and tricks. I can't remember the title of that thread though...
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: VB6 Real Unicode Display in RichTextBox without installing RICHTX32.OCX

    Scratching my head here. In I have a dream...about RICHTX32.OCX I provided an example just today that does that:
    Code:
        'Set the control to use the form's font
        hFont = GetCurrentObject(hDC, OBJ_FONT)
        SendMessage hWndRichEd, WM_SETFONT, hFont, 1
    Or a variation might be:
    Code:
        'Set the control to use a specific font.
        Dim ifnt As IFont
        Set ifnt = New StdFont
        With ifnt
            .Name = "Arial"
            .Size = 14
            SendMessage hWndRichEd, WM_SETFONT, .hFont, 1
        End With
        Set ifnt = Nothing

  6. #6

    Thread Starter
    Fanatic Member Flashbond's Avatar
    Join Date
    Jan 2013
    Location
    Istanbul
    Posts
    646

    Re: VB6 Real Unicode Display in RichTextBox without installing RICHTX32.OCX

    Yesss, I mentioned about it in my post. Thanks for the font tip!

Tags for this Thread

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