?
Solved

Help with scrolling & scrollbars in RichEdit 2.0

Posted on 2003-03-18
3
Medium Priority
?
411 Views
Last Modified: 2013-11-22
I'm Creating a MDI program, the main window and child windows are VB forms.  I'm tryng to create the RichTextBox on the child form dynamicaly, because I want version 2 of the RichEdit.

I can't seem to get the scrollbars to appear and autoscolling doesn't work either.
I'd also like to know how to set the focus to the created form automatically when the
parent form is at the top.  Thanks in advance.

Public Sub CreateRichEdit(frm As frmEdit) 'frmEdit is the VB created child form
  Dim style As Long           'window style
  Dim m_hWnd As Long          'Handle to created window
  Dim lib As Long             'Handle to RichEdit20.dll
  Dim retVal As Long          'Return value for SendMessage function
 
    style = ES_MULTILINE Or ES_LEFT Or ES_SUNKEN Or _
            WS_VISIBLE Or WS_CHILD
           
    lib = LoadLibrary("RichEd20.dll")
   
    m_hWnd = CreateWindowEx(WS_EX_CLIENTEDGE Or _
                            WS_HSCROLL Or _
                            WS_VSCROLL, _
                            RICHEDIT_CLASSA, _
                            vbNullString, _
                            style, _
                            0, _
                            0, _
                            frm.ScaleWidth, _
                            frm.ScaleHeight, _
                            frm.hWnd, _
                            0&, _
                            App.hInstance, _
                            ByVal 0&)
                           

    'Initialize data members
    hWnd = m_hWnd
    Owner = frm
    CEnum = childWindowNum
   
    'Set event mask
    retVal = SendMessageLong(hWnd, EM_SETEVENTMASK, 0&, ENM_CHANGE)
   
    'Set edit style
    retVal = SendMessageLong(hWnd, EM_SETEDITSTYLE, _
                             SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR)
   
    'Set RichEdit options
    retVal = SendMessageLong(hWnd, _
                             EM_SETOPTIONS, _
                             ECOOP_OR, _
                             ECO_AUTOHSCROLL Or _
                             ECO_AUTOVSCROLL Or _
                             ECO_AUTOWORDSELECTION Or _
                             ES_WANTRETURN)
   
    'Increment the child window counter
    Inc childWindowNum
   
    'Start subclassing
    Set formHook = New MsgHook
    formHook.StartSubclass Me.hWnd
   
End Sub

0
Comment
Question by:pwilden
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Accepted Solution

by:
pwilden earned 0 total points
ID: 8288643
The problem turned out to be the scale.  The Parent window coordinates were in twips, while the CreateWindowEx uses pixels.  I had the scrollbars, they were just out of view.
0
 

Expert Comment

by:CleanupPing
ID: 8532112
Hi pwilden,
This old question (QID 20554429) needs to be finalized -- no Experts commented, so delete it and get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 8957185
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

-->PAQ - with points refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GPrentice00
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question