Baraha Direct API reference

Files:
C/C++ Header: Declared in brh_direct.h
Visual Basic definition: brh_direct.bas
Library: Declared in brh_direct.dll
Import Library: Use brh_direct.lib


Note: When you are editing using Baraha Direct, it keeps track of the characters typed in an internal buffer. During editing, if you use the BACKSPACE key, it deletes the previous character and re-generates the whole character. But, if the keyboard is idle for more than 8 seconds, the internal buffer gets cleared automatically. Therefore, if you use BACKSPACE key after 8 seconds delay, the whole character is not re-generated. Instead, glyphs are deleted one by one. The internal buffer also gets cleared when you use the arrow keys to navigate through the document.


The BrhStartBarahaDirect() function initializes the Baraha Direct facility for your application. This function should be called before you call any other functions in the DLL.

C++:
BOOL BrhStartBarahaDirect (
          BOOL bGlobal ,                        
          LPCSTR  strCompanyName
          LPCSTR strRegKey                
);

VB:
Declare Function BrhStartBarahaDirect Lib "brh_direct.dll" (ByVal bGlobal As Long, ByVal strCompanyName As String, ByVal strRegKey As String) As Long

Parameters:
bGlobal: Specifies if BarahDirect should be system-wide or thread-level. If 1, Baraha Direct facility will be available for all the applications running in the system. If 0, only the application (thread) which called this function will have the Baraha Direct facility. Usually, all the applications should set this value to 0.

strCompanyName: Specifies the name of the company/person to which/whom this product is registered.

strRegkey: Specifies the registration key of the product.

Return Value:
If the function is successful, the return value is 1. If the function fails, the return value is 0.

Remarks:
Normally, BrhStartBarahaDirect()function should be called once per application (thread) before any other functions in the DLL are called. This function sets a keyboard hook to trap the key strokes that are sent to your application.

If you don't have valid registration key, then you have to pass empty strings("") for strCompanyName and strRegkey parameters. This causes Baraha Direct to run in the demo mode. The demo mode is fully functional as the registered mode, but displays a copyright message box.

After calling BrhStartBarahaDirect(), you have to call BrhActivateBarahaDirect ( 1 )  to switch ON the Baraha Direct facility. 


The BrhStopBarahaDirect() function un-installs the hook and releases the resources used by the brh_direct.dll. You have to call this function before exiting the application.

C++:
BOOL BrhStopBarahaDirect( );

VB:
Declare Function BrhStopBarahaDirect Lib "brh_direct.dll" () As Long

Return Value:
If the  keyboard hook is removed successfully, the return value is 1. If the function fails, the return value is 0.


The BrhActivateBarahaDirect( ) function activates/de-activates the Baraha Direct facility.

C++:
void BrhActivateBarahaDirect(

              BOOL bActivate                   
);

VB:
Declare Sub BrhActivateBarahaDirect Lib "brh_direct.dll" (ByVal bActivate As Long)

Parameters:
bActivate:  If 1, Baraha Direct will be activated (ON). If 0, Baraha Direct is de-activated (OFF).

Remarks:
Suppose you want to design a Visual Basic Form containing Kannada and English text fields. You can call BrhActivateBarahaDirect (1) when the Kannada text field gets the focus. Similarly, you can call BrhActivateBarahaDirect (0) when the English text field gets the focus. This way, you can programmatically activate/de-activate the Baraha Direct facility as and when required.


BrhSetInputMethod() function sets the Input Method for the Baraha Direct facility.

C++:
BOOL BrhSetInputMethod
(
          LPCSTR strInputFormat
);

VB:
Declare Function BrhSetInputMethod Lib "brh_direct.dll" (ByVal strInputFormat As String) As Long

Parameters:
strInputFormat: Specifies the Input Method. This can be one of the following.

"KANTRANS": Baraha Kannada Transliteration scheme.
"KAGAPA":      KGP Keyboard.
"DEVTRANS1":  Baraha Devanagari Transliteration scheme for Sanskrit.
"DEVTRANS2":  Baraha Devanagari Transliteration scheme for Hindi and Marathi.
"TAMTRANS":  Baraha Tamil Transliteration scheme.
"TELTRANS":  Baraha Telugu Transliteration scheme.
"MALTRANS":  Baraha Malayalam Transliteration scheme.
"GUJTRANS":  Baraha Gujarati Transliteration scheme.
"GURTRANS":  Baraha Gurumukhi Transliteration scheme.
"BENTRANS":  Baraha Bengali Transliteration scheme.
"ORITRANS":  Baraha Oriya Transliteration scheme.

Return Value:
Returns 1 if the strInputFormat is valid. Otherwise returns 0.


BrhSetOutputFormat() sets the Output Format for Baraha Direct.

C++:
BOOL BrhSetOutputFormat
(
           LPCSTR strOutputFormat
);

VB:
Declare Function BrhSetOutputFormat Lib "brh_direct.dll" (ByVal strOutputFormat As String) As Long

Parameters:
strOutputFormat: Specifies the Output Format. This can be one of the following.

"ANSI":              The output is glyph codes
"UNICODE":      The output is in UNICODE.

Remarks:
Normally for your VB/VC++ applications, you should use the "ANSI" output format. You may use "UNICODE" output format with applications that support UNICODE input. Currently very few applications support this feature.

Return Value:
Returns 1 if the strOutputFormat is valid. Otherwise returns 0.


BrhSetKeyboardDelay()sets the keyboard delay for Baraha Direct.

C++:
void BrhSetKeyboardDelay

          short iDelay
);

VB:
Declare Sub BrhSetKeyboardDelay Lib "brh_direct.dll" (ByVal iDelay As Integer)

Parameters:
iDelay : Specifies the keyboard delay in milliseconds.

Remarks:
The keyboard delay is the time in milliseconds used by Baraha Direct when sending character messages to the target application. By default, the keyboard delay is set to 20 ms, which is sufficient for most of the applications. Sometimes, the target application may not be fast enough to work synchronously with Baraha Direct, in which case some character messages can be lost. In such cases, you have to increase this value to say 50 ms or more.