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 

Many people asked the same question all over the WEB: Is it possible to do RICH text editing inside a Pocket PC as it is done in the desktop environment? Well, since I couldn't find any solution that was similar to the RichEdit, I decided to write my link to the existing CE ink capabilities.

Yes, there are some examples of using the HtmlView libraries that wrap the HtmlView control and allow you to create an HTML based dialog with use of HTML code to display colors, pictures and so on. I can't say much about that solution since I have not test it yet.

My goal was to allow eVB easy access to richink.dll. As we know, that flavor is reachable only through C++/eVC. Due to the restrictions of the eVB we are not able to code the callback functions with eVB (at least as far as I know).

The ecncrichink.dll would simplify the use of the richink.dll that already exists on most of the handheld units.

ecncrichink.dll WILL

1) allow eVB programmers to insert any PocketWord ink file in the RichInk window by simply reading RTF, PWI or any PWI formatted file.

function name: RTFfrom_file (see the evb example)

2) read RTF formatted STRING from eVB environment and put it into richink window.

function name: RTFfrom_string (see the evb example)

To use the above function efficiently requires some basic knowledge of the RTF format.

We can format RTF string in DESIGN or RUN time which depends on the eVB programming. In both cases it will clear the richink context and paste a new formatted string on any change of/in the RTF string.

Before we do anything in the eVB we have to create a Richink control/window.

Here is how to Create a Richink control

Dim y As Long
y = LoadLibrary("\windows\richink.dll")
hwndInk = CreateWindowEx(1, "richink", "my_rich", _
ES_MULTILINE Or WS_HSCROLL Or WS_VSCROLL Or _
WS_VISIBLE, 14, 25, 200, 80, 0, 0, 0, 0)

Call ShowWindow(hwndInk, 10)
Call UpdateWindow(hwndInk)
InitRichInkDLL

In the above example InitRichInkDLL and UpdateWindow are not really necessary, but to follow the convention and to make it according to the rules we should include it.

How to use CreateWindowEX and create a control that will meet your needs see the CE help file included with embedded visual tools... you know where to find it, right? :)

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

Dim y As Long
y = RTFfrom_file(hwndInk, "Windows\\Test.rtf")

as simple as that (pictures from rtf file will not be shown)

Return value
The RTFfrom_file will return 0 as success

How does it look like in the real life you can take a look at the picture below.

Next Page