EM_AUTOURLDETECT doesn't work with RichTextBox?

Hi Experts
plz, tell why the following code doesn't work
(i am working in windows 2000)
sLib = "RICHED20.DLL"
    m_hLib = LoadLibrary(sLib)
    If m_hLib = 0 Then
        sLib = "RICHED32.DLL"
        sClass = RICHEDIT_CLASS10A
        m_hLib = LoadLibrary(sLib)
    End If
      If m_hLib <> 0 Then
         dwStyle = WS_CHILD Or WS_CLIPCHILDREN Or _
         m_hWndParent = Me.hwnd
         m_hWnd = CreateWindowEx(dwExStyle, sClass, "", dwStyle, _
            0, 0, Me.ScaleWidth \ Screen.TwipsPerPixelX, Me.ScaleHeight \ Screen.TwipsPerPixelY, _
            m_hWndParent, 0, App.hInstance, 0)
        If (m_hWnd <> 0) Then
            ShowWindow m_hWnd, 1
            EnableWindow m_hWnd, 1
            Dim a As Long
            a = SendMessage(m_hWnd, EM_GETEVENTMASK, 0, 0)
            a = SendMessage(m_hWnd, EM_SETEVENTMASK, 0, ByVal ENM_LINK Or a)
            a = SendMessage(m_hWnd, EM_AUTOURLDETECT, Abs(1), 0)
        End If
    End If
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What didn't work? It works for me but I may have used a different class-name because you didn't include ANY declarations.

There are mainly 2 possibilities for it not to auto-detect the URLs (if that's what your problem was)..

1.) Use "RICHEDIT20A" for the RichEdit class-name (newer class that supports the auto-detect).
2.) Pass the last parameter of SendMessage() ByVal:

a = SendMessage(m_hWnd, EM_AUTOURLDETECT, Abs(1), ByVal 0)

Also, you need to subclass the form's (parent window) WindowProc to receive a WM_NOTIFY message where the notification will be EN_LINK.

Here's a quick article on the subclassing portion. It's not for VB but you only need to know the API required anyways.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pramod_kumar_tkAuthor Commented:
Ok, Let my try
pramod_kumar_tkAuthor Commented:
u r right the Byval makes the problem
thanx a lot
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.