EditorGadget(), Richedit version 4.1

Just starting out? Need help? Post your questions and find answers here.
horst
Enthusiast
Enthusiast
Posts: 197
Joined: Wed May 28, 2003 6:57 am
Location: Munich
Contact:

EditorGadget(), Richedit version 4.1

Post by horst »

I am having problems with East Asian URLs (Unicode): they are not recognised properly (using the #EM_AUTOURLDETECT Message).

I know there is a work-around by enclosing them in angle brackets, for example <file:\\D:\帮助文档>, but it seems that Richedit version 4.1 supports East Asian URLs.

Question: How can I take advantage of version 4.1? (The DLL name is not Riched20.dll but "Msftedit.dll".)

BTW: I only use plain text, no formatting..
Horst.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4955
Joined: Sun Apr 12, 2009 6:27 am

Re: EditorGadget(), Richedit version 4.1

Post by RASHAD »

The next is how to create Richedit v 4.1
I am not sure if it support East Asian URLs(Can not test it)

Code: Select all

Global HwndEdit

#AURL_ENABLEURL           = 1
#AURL_ENABLEEMAILADDR     = 2
#AURL_ENABLETELNO         = 4
#AURL_ENABLEEAURLS        = 8
#AURL_ENABLEDRIVELETTERS  = 16
#AURL_DISABLEMIXEDLGC     = 32

Procedure WndProc(hWnd, uMsg, wParam, lParam)
  result = #PB_ProcessPureBasicEvents
  Select uMsg
  Case #WM_NOTIFY
    *el.ENLINK = lParam
    If *el\nmhdr\code=#EN_LINK
      If *el\msg=#WM_LBUTTONDOWN
        StringBuffer = AllocateMemory(#MAX_PATH)
        txt.TEXTRANGE
        txt\chrg\cpMin = *el\chrg\cpMin
        txt\chrg\cpMax = *el\chrg\cpMax
        txt\lpstrText = StringBuffer
        Result = SendMessage_(HwndEdit, #EM_GETTEXTRANGE, 0, txt)
        Debug PeekS(StringBuffer,Result,#PB_Unicode)
        FreeMemory(StringBuffer)
      EndIf
    EndIf
  EndSelect
  ProcedureReturn result
EndProcedure

OpenWindow(0, 0, 0, 400, 400, "PureBasic Window", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget| #PB_Window_ScreenCentered)
 
  If OpenLibrary(0,"msftedit.dll")
    Class_Name$ = "RichEdit50W"
    HwndEdit = CreateWindowEx_(#WS_EX_STATICEDGE,Class_Name$,"", #WS_VISIBLE | #WS_CHILDWINDOW | #ES_AUTOHSCROLL  | #WS_VSCROLL | #ES_MULTILINE | #ES_WANTRETURN |#ES_NOHIDESEL, 10,10,380,380,WindowID(0),300,GetModuleHandle_(0),0) 
  Else
    MessageRequester("Error","Sorry ,RichEdit Can not be created",#MB_ICONWARNING)
  EndIf  
  
SendMessage_(HwndEdit, #EM_SETEVENTMASK, 0, #ENM_LINK|SendMessage_(HwndEdit, #EM_GETEVENTMASK, 0, 0))
SendMessage_(HwndEdit, #EM_AUTOURLDETECT,#AURL_ENABLEURL, 0)
SendMessage_(HwndEdit,#WM_SETTEXT,0,"http://www.purebasic.com"+Chr(10))
SetWindowCallback(@WndProc())
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
End

Egypt my love
horst
Enthusiast
Enthusiast
Posts: 197
Joined: Wed May 28, 2003 6:57 am
Location: Munich
Contact:

Re: EditorGadget(), Richedit version 4.1

Post by horst »

RASHAD wrote:The next is how to create Richedit v 4.1
Thanks RASHAD,
however, it seems that the AURL_ENABLE.. parameters are only available in Richedit 7.0, which ships with Office 2010 (see http://blogs.msdn.com/b/murrays/archive ... links.aspx )

It would be a problem anyhow, if I could not use PB's EditorGadget() and SplitterGadget() etc..
So, currently the best thing to do is to recommend the work-around with the angle brackets.
Horst.
Post Reply