As I can define this function to use in the FWH/xHarbour ?

As I can define this function to use in the FWH/xHarbour ?

Postby vilian » Tue Jul 24, 2007 1:17 pm

Antonio,

As I can define this function to use in the FWH/xHarbour ?

Code: Select all  Expand view
CreateTerWindow

Open a TER Window:

HWND CreateTerWindow(ptr)


struct arg_list far *ptr;
The ptr argument points to a structure that provides the initial parameters to open a window. This structure includes the following parameters:



   
struct arg_list {


int x
Initial X position of the editing window. You may specify CW_USEDEFAULT here to use the default value. The CW_USEDEFAULT constant is defined by Windows as hex 8000 for 16 bit and hex 80000000 for 32 bit.


int y
Initial Y position of the editing window. You may specify CW_USEDEFAULT here to use the default value.


int width
Window width. You may specify CW_USEDEFAULT here to use the default value


int height
Window Height. You may specify CW_USEDEFAULT here to use the default value.


int LineLimit
Maximum number of lines allowed for text editing. Set this field to 0 to allow unlimited number of lines.


BOOL WordWrap
If set to TRUE, this flag enables the word wrapping feature.


BOOL PrintView
Normally (PrintView = FALSE) the text lines are wrapped at the right edge of the window. This is a convenient editing mode with better performance. In the print view edit mode, however, the text lines are wrapped as they would be wrapped when printed at the current printer.


BOOL PageMode
Set to TRUE to facilitate editing of documents one page at a time. This feature is useful when editing multiple column documents. The text is displayed in side-by-side columns. This mode also implies the PrintView mode.


BOOL FittedView
Special case of the page mode in which the text wraps to the window width and the soft page breaks are not displayed


BOOL ShowStatus
If set to TRUE, the editor will display a status line describing the current cursor location, and the insert/overtype indicator.


BOOL ShowMenu
If set to TRUE, the editor displays the editor menu under the caption bar. When set to FALSE, the editor commands must be selected using only the accelerator keys.


BOOL ShowHorBar
If set to TRUE, the editor displays the horizontal scroll bar.


BOOL ShowVerBar
If set to TRUE, the editor displays the vertical scroll bar.


BOOL ruler
Set this variable to TRUE to show a ruler with tab stops.


BOOL ToolBar
Set this variable to TRUE to show the tool bar.


BOOL UserCanClose
Set this variable to TRUE if you want your user to be able to close the TER window by selecting the exit option from the TER menu. Otherwise, your application will need to close the window by using the CloseTer function.


BOOL BorderMargins
Set this field to TRUE to create a thin margin around the text area within the TER window. This margin area is for cosmetic purpose only.


BOOL ReadOnly
This is a browser mode which does not allow text modifications.


int InitLine
The first line number to position on when the TER routine is called.


char InputType
This field specifies the input type to the editor. If you wish to pass a text file name to the editor, set this flag to 'F'. However, if the text input will be passed in a global memory buffer, set this flag to 'B'.


char file[129]
If the InputType field is set to 'F', this field specifies the full path of the input file.


HANDLE hBuffer
If the InputType field is set to 'B', this field specifies the handle to the global memory containing the input text data. To specify an empty buffer, allocate a buffer for 1 byte, place the 'delim' character in the first byte and set the 'BufferLen' field to 1. The input memory handle must be unlocked before calling the editor routine. You can get the updated text by using the GetTerBuffer prior to closing the TER window.


long BufferLen
When the InputType field is set to 'B', the BufferLen field specifies the length of the input buffer.


char delim
This character should be be set to 13 (carriage return character).


int SaveFormat
This field determines the format of the output file or buffer:


 
SAVE_DEFAULT:
Save in the format of the input file.


 
SAVE_TER:
Save in the native TER format.


 
SAVE_RTF:
Save in the Rich Text Format.


 
SAVE_TEXT:
Save in ASCII format.


 
SAVE_TEXT_LINES:
Save in ASCII format with line breaks.


 
SAVE_UTEXT
Save in the Unicode text format (not available in 16 bit)


HANDLE hInst
Handle for the current instance of the application.


HWND hParentWnd
Handle of the parent window. The DLL sends the TER_CLOSE message to this function before closing a TER window (see the CloseTer API function).


HWND hTextWnd
The editor fills in this field with the window handle of the editor window. The editor does this as soon as the window is created. You will need this handle to use other TER API functions.


DWORD style
The window style that you provide here is simply passed to the CreateWindow function.


char FontTypeFace[30]
Default font typeface for the document. Example: "Helv", "Courier", "System" etc. A menu option in the TER window provides multiple selections of typeface and point sizes to choose from.


int PointSize
Point size of the default font. Please remember that 72 points are equal to one inch. Most written correspondences use a letter size of 10 or 12 points.


BOOL open
The editor set this variable to a TRUE value after initializing a TER window.


BOOL modified
This variable is reserved for internal use.

}
 


Description: This function opens a TER window.

Return Value: If successful, the function returns the window handle of the new window. Otherwise it returns a NULL value. The handle to the newly opened window is also returned to you using the hTextWnd variable within the arg_list structure. If your application provides the data using a global buffer, the handle to the specified global buffer becomes the property of the DLL. Your application MUST not try to lock or free this handle. To get the updated text data, you should use the GetTerBuffer function.

Comments: This function is not available as an ActiveX control method. It must be used as a DLL function.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Tue Jul 24, 2007 2:49 pm

Vilian,

The easiest way is to fill the C structure from C code:
Code: Select all  Expand view
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( CREATETERWINDOW )
{
    struct arg_list ptr;

    ... fill the ptr ... members using hb_par...( x ), i.e.:
    ptr.width = hb_parnl( 3 );

    hb_retnl( ( ULONG ) CreateTerWindow( &ptr ) );   
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Tue Jul 24, 2007 5:07 pm

Antonio,

When I try to compile appear the following messages:

Code: Select all  Expand view
Error E2450 \\tec2000\\sig50\\SIG241.PRG 1410: Undefined structure 'arg_list' in function HB_FUN_CREATETERWINDOW
Error E2449 \\tec2000\\sig50\\SIG241.PRG 1410: Size of 'ptr' is unknown or zero in function HB_FUN_CREATETERWINDOW
Error E2450 \\tec2000\\sig50\\SIG241.PRG 1410: Undefined structure 'arg_list' in function HB_FUN_CREATETERWINDOW
Error E2450 \\tec2000\\sig50\\SIG241.PRG 1410: Undefined structure 'arg_list' in function HB_FUN_CREATETERWINDOW
Error E2449 \\tec2000\\sig50\\SIG241.PRG 1410: Size of 'ptr' is unknown or zero in function HB_FUN_CREATETERWINDOW
Error E2451 \\tec2000\\sig50\\SIG241.PRG 1412: Undefined symbol 'x' in function HB_FUN_CREATETERWINDOW
Error E2451 \\tec2000\\sig50\\SIG241.PRG 1413: Undefined symbol 'y' in function HB_FUN_CREATETERWINDOW
Error E2451 \\tec2000\\sig50\\SIG241.PRG 1414: Undefined symbol 'width' in function HB_FUN_CREATETERWINDOW
Error E2451 \\tec2000\\sig50\\SIG241.PRG 1415: Undefined symbol 'height' in function HB_FUN_CREATETERWINDOW
Warning W8065 \\tec2000\\sig50\\SIG241.PRG 1417: Call to function 'CreateTerWindow' with no prototype in function HB_FUN_CREATETERWINDOW


What I am making made a mistake?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Tue Jul 24, 2007 5:48 pm

Try it this way:
Code: Select all  Expand view
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HWND CreateTerWindow( ... );

HB_FUNC( CREATETERWINDOW )
{
    hb_retnl( ( ULONG ) CreateTerWindow( hb_parnl( 1 ),  // x
                                                                           hb_parnl( 2 ), // y
                                                                           hb_parnl( 3 ), // width
                                                                           hb_parnl( 4 ), // height
                                                                           hb_parnl( 5 ), // lineLimit
                                                                           hb_parl( 6 ), // WordWrap
                                                                           hb_parl( 7 ), // PrintView
                                                                           hb_parl( 8 ), // PageMode
                                                                           hb_parl( 9 ), // FittedView
                                                                           <continue you :-) >
                                                                           ) );         
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Wed Jul 25, 2007 1:56 am

Antonio,

Thanks.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby FiveWiDi » Fri Dec 12, 2008 12:19 am

vilian wrote:Antonio,

Thanks.


Hola Vilian,

Conseguistes funcionar CreateTerWindow() desde FWH?

Cómo?


Saludos
Carlos G.
FiveWiDi
 
Posts: 1060
Joined: Mon Oct 10, 2005 2:38 pm

Postby vilian » Fri Dec 12, 2008 11:15 am

Sim, o suporte de subsystem é excelente e ajudou muito.

Code: Select all  Expand view
xDll := LoadLib32("TER15.DLL")
   TerSetLicenceKey("XXXX-XXXX-XXXX")

     DEFINE WINDOW oWndEdt TITLE "Editor de Laudos" MDICHILD OF oWnd

      DEFINE BUTTONBAR oBar 3D SIZE 22,27 TOP OF oWndEdt

         DEFINE BUTTON NAME "OPEN"  OF oBar              ;
                ACTION( AbrirLaudo(oWndEdt,oActivex) )   ;
                TOOLTIP "Definir Laudos de Exames"       ;
                NOBORDER

         DEFINE BUTTON NAME "AUTOTEXT" OF oBar           ;
                ACTION ( DefAutoText(cMedAtual,oWndEdt) );
                TOOLTIP "Definir Auto-textos"            ;
                WHEN .NOT. Empty(cMedAtual) NOBORDER

         DEFINE BUTTON NAME "BBASS" OF oBar ;
                ACTION ( IncAssMed(cMedAtual,oWndEdt) )  ;
                TOOLTIP "Incluir assinatura do médico no laudo" ;
                WHEN .NOT. Empty(cMedAtual) NOBORDER

         DEFINE BUTTON NAME "BBINIBAK"  OF oBar          ;
                ACTION( GravaArquivo() )                 ;
                TOOLTIP "Salvar arquivo"                 ;
                NOBORDER

         DEFINE BUTTON NAME "BBCONS"  OF oBar            ;
                ACTION( PesqLaudo(oWndEdt) )             ;
                TOOLTIP "Pesquisar Laudos por paciente"  ;
                NOBORDER

         DEFINE BUTTON NAME "BBPRINT"  OF oBar           ;
                ACTION IF(GravaArquivo(.t.),oActiveX:Do("TerCommand",ID_PRINT),NIL);
                TOOLTIP "Imprimir laudos"                ;
                NOBORDER

         DEFINE BUTTON NAME "BBPESQ"  OF oBar            ;
                ACTION oActiveX:Do("TerCommand",ID_PRINT_PREVIEW);
                TOOLTIP "Visualizar impressão"           ;
                NOBORDER

         DEFINE BUTTON NAME "UNDO"  OF oBar ;
                ACTION(oActiveX:Do("TerCommand",ID_UNDO));
                TOOLTIP "Desfaz";
                NOBORDER;
                GROUP

         DEFINE BUTTON NAME "REDO"  OF oBar ;
                ACTION(oActiveX:Do("TerCommand",ID_REDO));
                TOOLTIP "ReFaz";
                NOBORDER

         DEFINE BUTTON oBtn NAME "LINDUP"  OF oBar ;
                ACTION MudaTipoLinha(oBtn)         ;
                TOOLTIP "Espaço duplo entre linhas";
                NOBORDER;
                GROUP

         DEFINE BUTTON NAME "EXITEDT"  OF oBar ;
                ACTION ( FechaEditor() )       ;
                TOOLTIP "Fechar/Sair do editor";
                NOBORDER GROUP


      @ 7, 300 SAY oSayEdt PROMPT "Chv:" SIZE 160, 15 PIXEL OF oBar

      oActiveX = TActiveX():New( oWndEdt, "TOC15.Toc15Ctrl.1" )

      oWndEdt:oClient = oActiveX // To fill the entire window surface

      oActiveX:Do("TerCommand",ID_RULER)
      oActiveX:Do("TerCommand",ID_TOOL_BAR)
      oActiveX:Do("TerCommand",ID_SHOW_PAGE_BORDER)
      oActiveX:Do("TerSetFlags4",1,TFLAG4_ONE_ROW_TOOLBAR)
      oActiveX:Do("TerRecreateToolbar",1)

      oActiveX:bOnEvent := { | event, aParams,nKey,nx,ny | EventInfo( event, aParams,oActiveX,nKey,nx,ny ) }

      oEditor := TEditor()
      oEditor:cAlias := "AUT"
      oEditor:Cargo  := {NIL,NIL,cMedAtual}

      nHand := oActiveX:GetProp("hWnd")

   ACTIVATE WINDOW oWndEdt MAXIMIZED
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby FiveWiDi » Fri Dec 12, 2008 12:09 pm

vilian wrote:Sim, o suporte de subsystem é excelente e ajudou muito.

Code: Select all  Expand view
xDll := LoadLib32("TER15.DLL")
   TerSetLicenceKey("XXXX-XXXX-XXXX")

     DEFINE WINDOW oWndEdt TITLE "Editor de Laudos" MDICHILD OF oWnd

      DEFINE BUTTONBAR oBar 3D SIZE 22,27 TOP OF oWndEdt

         DEFINE BUTTON NAME "OPEN"  OF oBar              ;
                ACTION( AbrirLaudo(oWndEdt,oActivex) )   ;
                TOOLTIP "Definir Laudos de Exames"       ;
                NOBORDER

         DEFINE BUTTON NAME "AUTOTEXT" OF oBar           ;
                ACTION ( DefAutoText(cMedAtual,oWndEdt) );
                TOOLTIP "Definir Auto-textos"            ;
                WHEN .NOT. Empty(cMedAtual) NOBORDER

         DEFINE BUTTON NAME "BBASS" OF oBar ;
                ACTION ( IncAssMed(cMedAtual,oWndEdt) )  ;
                TOOLTIP "Incluir assinatura do médico no laudo" ;
                WHEN .NOT. Empty(cMedAtual) NOBORDER

         DEFINE BUTTON NAME "BBINIBAK"  OF oBar          ;
                ACTION( GravaArquivo() )                 ;
                TOOLTIP "Salvar arquivo"                 ;
                NOBORDER

         DEFINE BUTTON NAME "BBCONS"  OF oBar            ;
                ACTION( PesqLaudo(oWndEdt) )             ;
                TOOLTIP "Pesquisar Laudos por paciente"  ;
                NOBORDER

         DEFINE BUTTON NAME "BBPRINT"  OF oBar           ;
                ACTION IF(GravaArquivo(.t.),oActiveX:Do("TerCommand",ID_PRINT),NIL);
                TOOLTIP "Imprimir laudos"                ;
                NOBORDER

         DEFINE BUTTON NAME "BBPESQ"  OF oBar            ;
                ACTION oActiveX:Do("TerCommand",ID_PRINT_PREVIEW);
                TOOLTIP "Visualizar impressão"           ;
                NOBORDER

         DEFINE BUTTON NAME "UNDO"  OF oBar ;
                ACTION(oActiveX:Do("TerCommand",ID_UNDO));
                TOOLTIP "Desfaz";
                NOBORDER;
                GROUP

         DEFINE BUTTON NAME "REDO"  OF oBar ;
                ACTION(oActiveX:Do("TerCommand",ID_REDO));
                TOOLTIP "ReFaz";
                NOBORDER

         DEFINE BUTTON oBtn NAME "LINDUP"  OF oBar ;
                ACTION MudaTipoLinha(oBtn)         ;
                TOOLTIP "Espaço duplo entre linhas";
                NOBORDER;
                GROUP

         DEFINE BUTTON NAME "EXITEDT"  OF oBar ;
                ACTION ( FechaEditor() )       ;
                TOOLTIP "Fechar/Sair do editor";
                NOBORDER GROUP


      @ 7, 300 SAY oSayEdt PROMPT "Chv:" SIZE 160, 15 PIXEL OF oBar

      oActiveX = TActiveX():New( oWndEdt, "TOC15.Toc15Ctrl.1" )

      oWndEdt:oClient = oActiveX // To fill the entire window surface

      oActiveX:Do("TerCommand",ID_RULER)
      oActiveX:Do("TerCommand",ID_TOOL_BAR)
      oActiveX:Do("TerCommand",ID_SHOW_PAGE_BORDER)
      oActiveX:Do("TerSetFlags4",1,TFLAG4_ONE_ROW_TOOLBAR)
      oActiveX:Do("TerRecreateToolbar",1)

      oActiveX:bOnEvent := { | event, aParams,nKey,nx,ny | EventInfo( event, aParams,oActiveX,nKey,nx,ny ) }

      oEditor := TEditor()
      oEditor:cAlias := "AUT"
      oEditor:Cargo  := {NIL,NIL,cMedAtual}

      nHand := oActiveX:GetProp("hWnd")

   ACTIVATE WINDOW oWndEdt MAXIMIZED


Vilian,

Esta noche lo pruebo.

Um Grande Obrigado
Carlos G.
FiveWiDi
 
Posts: 1060
Joined: Mon Oct 10, 2005 2:38 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests