Using DLL Functions with the OCX
Much of the TER functionality is accessed through the dll functions. To access a dll function, the function must be declared. The following are examples of local external function declarations for u_ter.
private function int HtsInitialize( long hWnd, long hParentWnd ) library "HTS15.dll"
private function int GetTerFields( long hwnd, ref s_rtext_parms_32 parms ) library "ter32.dll"
private function int GetTerFieldsAlt( long hWnd, ref s_parms parms, long LineNo ) library "ter32.dll"
private function int InsertTerText( long hWnd, ref blob aBlob, int repaint ) library "ter32.dll"
function long HandleToStr( ref blob ablob, long length, long hMem ) library "ter32.dll"
private function int TerInsertRtfFile( long hWnd, ref string rtf_file, long line, int column, int repaint ) library "ter32.dll"
Once a function is declared, it can be used in the same manner as a PowerBuilder function. The PowerBuilder compiler performs error checking against the function declarations. If the function declarations are not correct, you will get a run-time error.
Note that integers are passed instead of booleans for arguments. This is because PowerBuilder does not handle booleans well in external function calls. You will need to test the integer values that represent TER booleans in a user function. For example:
Lb_boolean = ( HtsInitialize( il_hWnd, hParentWnd ) <> 0 )
Some DLL functions require passing integer and boolean values in structures. In Win32 PowerBuilder applications you must create a structure that passes only longs. Your code must convert or interpret the values passed back. The length of boolean and integer values in a structures does not correctly correspond to the win32 values produced by the Visual C++ compiler.