you can use any cdecl functions.
You can use a scilexer.dll without any tricks if you want to use syntax highlighting. For example:
Code:
option explicit
private m_hscintillalib as long
private m_hwnd as long
public property get text() as string
dim lsize as long
lsize = sendmessage(m_hwnd, sci_getlength, 0, byval 0&)
if lsize then
text = strconv(space$(lsize), vbfromunicode)
sendmessage m_hwnd, sci_gettext, lsize + 1, byval text
text = strconv(text, vbunicode)
end if
end property
public property let text( _
byref svalue as string)
sendmessage m_hwnd, sci_settext, 0, byval cstr(strconv(svalue, vbfromunicode))
end property
private sub usercontrol_gotfocus()
setfocusapi m_hwnd
end sub
private sub usercontrol_initialize()
dim skeywords as string
dim bisinide as boolean
skeywords = "and as boolean byref byval call case class const " & _
"dim do each else elseif empty end " & _
"endif eqv exit false for function get goto " & _
"if imp in is let like loop " & _
"lset me mod new next not nothing null on " & _
"optional or paramarray preserve private public redim rem resume " & _
"rset select set static stop sub then to " & _
"true typeof until variant wend while with xor " & _
"cbool cbyte ccur cdate cdbl cdec cint clng csng cstr " & _
"cvar cvdate cverr " & _
"message scripte scriptd isscript enablelist disablelist islist " & _
"base64tobytearray filetobytearray global_l global_s global_b gotolabel gotoindex " & _
"getindex getlabel getbase64"
debug.assert maketrue(bisinide)
if bisinide then
m_hscintillalib = loadlibrary(app.path & "\release\scintilla\scilexer.dll")
else
m_hscintillalib = loadlibrary(app.path & "\scintilla\scilexer.dll")
end if
if m_hscintillalib = 0 then
err.raise 7, "ctlscintilla::ctlscintilla"
end if
m_hwnd = createwindowex(ws_ex_clientedge, "scintilla", "test", ws_child or ws_visible, _
0, 0, usercontrol.scalewidth, usercontrol.scaleheight, usercontrol.hwnd, 0, app.hinstance, 0)
if m_hwnd = 0 then
err.raise 7, "ctlscintilla::ctlscintilla"
end if
sendmessage m_hwnd, sci_setlexer, sclex_vb, byval 0&
sendmessage m_hwnd, sci_setkeywords, 0, byval cstr(strconv(skeywords, vbfromunicode))
sendmessage m_hwnd, sci_stylesetfont, style_default, byval cstr(strconv("courier new", vbfromunicode))
sendmessage m_hwnd, sci_styleclearall, 0, byval 0&
sendmessage m_hwnd, sci_stylesetfore, sce_b_keyword, byval &hf00000
sendmessage m_hwnd, sci_stylesetfore, sce_b_comment, byval &ha000&
sendmessage m_hwnd, sci_stylesetfore, sce_b_string, byval &h80
sendmessage m_hwnd, sci_setmarginwidthn, 0, byval sendmessage(m_hwnd, sci_textwidth, style_linenumber, _
byval cstr(strconv("_999999_", vbfromunicode)))
end sub
private sub usercontrol_resize()
movewindow m_hwnd, 0, 0, usercontrol.scalewidth, usercontrol.scaleheight, 0
end sub
private sub usercontrol_terminate()
if m_hwnd then
destroywindow m_hwnd
m_hwnd = 0
end if
if m_hscintillalib then
freelibrary m_hscintillalib
m_hscintillalib = 0
end if
end sub