Skip to main content

Past Blast

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Windows Mobile Developer Controls

Using eVB to access the richink control (via ecncrichink.dll)

Written by Mike Dejanovic  [author's bio]  [read 36040 times]
Edited by Derek

Download the code

Page 1  Page 2 

Here is an example of the code to read from a RTF STRING

Dim y As Long
Dim LLength As Long
Dim lpszString As Long
Dim rtf_demo_string As String

'test string
'===========
rtf_demo_string = "{\rtf1\deftab720{\fonttbl _
{\f2\fswiss Tahoma;}}{\colortbl\red0\green0 _
\blue0;\red255\green0\blue0;\red0\green255 _
\blue0;\red0\green0\blue255;\red0\green255 _
\blue255;\red255\green255\blue0;} _
\deflang1033\plain\f2\fs17\cf1\b This _
\plain\f2\fs17\cf2 is \plain\f2\fs17\cf3 _
a \plain\f2\fs17\cf4\b test! \plain\f2 _
\fs17\cf5\b\ul underline \par }"

'prepare the string so we can send the pointer to the DLL

'Determine the memory needed
'===========================
LLength = CLng(LenB(rtf_demo_string) + 1)

'Allocate the memory and get a pointer to it
'===========================================
lpszString = LocalAlloc(LMEM_ZEROINIT, LLength)

'Copy the data to the above memory location
'==========================================
MemMove lpszString, rtf_demo_string, LLength

'invoke encnrichink.dll and send the necessary info to "digest it"
y = RTFfrom_string(hwndInk, rtf_demo_string, LLength)

'free the allocated memory
'=========================
LocalFree lpszString

Return value
The RTFfrom_string will return 0 upon success.

How does it look like in the real life, take a look at the picture below

The above chunk of the code is a bit of playing pointers with eVB, well, it works :-)

ecncrichink.dll declaration

Public Declare Function RTFfrom_file Lib "ecncrichink.dll" _
(ByVal hwnd As Long, ByVal filename As String) As Long _

Public Declare Function RTFfrom_string Lib "ecncrichink.dll" _
(ByVal hwnd As Long, ByVal rtf_string As String, ByVal str_size _
As Long) As Long

Put the ecncrichink.dll in ?:\windows directory or in your local directory but then make sure you have whole path specified in the DECLARATION statement!!

All the files needed: dlls, complete evb project, and pictures can be found at http://www.handheld.e-cnc.com, More and a detailed info about the author can be found at http://www.resume.e-cnc.com.

Previous Page