Multi-Coloured Text Input Boxes using a DLL
	by Ray Fisher 

    rmfisher@talk21.com OR
    rmfisher@btinternet.com

In Newsletter No.100 I described how to create a custom control
for text input that could have any colour of text and any colour
of background.
In a programme using this method it was necessry to have a number
of functions at the end of the main part of the code. This was a
bit messy, so I have tried to encapsulate the methods in a DLL.
By doing this most of the code is hidden from sight, and a single
call to the DLL function is all that is required for each instance
of the control. This is demonstated in '_1stTestdllv01.bas'.

The calling syntax is:

open "rmfDLLv01.dll" for dll as #rmfdll
calldll #rmfdll, "reInputBox", _
  handle    as long, _ ' handle of parent window
  inkHex$   as ptr, _  ' ink colour
  paperHex$ as ptr, _  ' paper colour
  x         as long, _ ' x co-ord
  y         as long, _ ' y co-ord
  w         as long, _ ' width
  h         as long, _ ' height
  max       as long, _ ' max chars
  hTB       as long    ' returns a handle to the new control
close #rmfdll

This will create a single line input box.
The background can be set to any colour.
The font can be set to any colour.
This version uses HEX colour values for input.
The position and size can be set.
The maximum number of chars entered can be set.
The function returns a handle to the new control.

If multiple instances of the control are required, the code can be
kept simple by enclosing the call to the DLL function in a LB
function, and this can be called from the main part of the programme
with a single line of code. See '_2ndTestdllv01.bas'. In this demo
I have added extra code so that the controls can be tabbed by
using the ESC key.

I have supplied the source code for the DLL for those who may be
interested. At the moment the DLL only contains this single external
function. Because the colour information is passed as a hexadecimal
value, in Liberty BASIC this must be passed as a string. Inside the
function the calls to SendMessage() requires that the colour be passed
as a RGB value. Therefore it will be seen that there is an internal
function 'hex2rgb()' that converts the HEX string into a RGB value.
Because this is all inside the DLL, it is hidden from view in usage.

I hope this is of interest, and any of the code can be copied or altered.
