Includes en .prg (SOLUCIONADO)

Post Reply
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Includes en .prg (SOLUCIONADO)

Post by Compuin »

Buenas tardes

Es posible agregar las definiciones de una archivo .ch (Include) en el .prg para asi no tener que agregar el mismo en los includes de FWH ? Si es posible, algun ejemplo ?

Atento a sus comentarios
Last edited by Compuin on Sun Nov 04, 2018 5:46 pm, edited 1 time in total.
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Includes en .prg

Post by karinha »

Te basta crear un único archivo.ch y en el agregar todos los includes.ch del proyecto.

Ejemplo:

Code: Select all

#Include "Fivewin.Ch"
#Include "Dll.ch"
#include "dbinfo.ch"
#Include "FastReph.Ch"
#Include "Directry.ch"
#Include "DSay.Ch"
#include "fileio.ch"
#include "Image.ch"
#Include "Mail.Ch"
#Include "Ord.Ch"
#Include "Report.Ch"
#Include "SSay.Ch"
#Include "URLLink.ch"
// colores
#Define CLR_LGRAY      nRGB( 230, 230, 230 )
#Define CLR_LGREEN     nRGB( 190, 215, 190 )
#Define CLR_VERMELHO   nRGB( 255, 000, 000 )
#Define CLR_AMARELO    nRgb( 255, 255, 000 )
#Define CLR_BOMBOM     nRGB( 000, 000, 000 )
#Define CLR_MARROM     nRGB( 135, 206, 250 )
#Define CLR_MENTA      nRGB( 221, 255, 238 )
#Define CLR_HMENTA     nRGB( 000, 128, 000 )
#Define CLR_SOFTYELLOW nRGB( 255, 251, 225 )
#Define COLOR_BTNFACE  15

#Define TRUE  .T.
#Define FALSE .F.

#Define PAD_LEFT            0
#Define PAD_RIGHT           1
#Define PAD_CENTER          2

#Define SW_SHOWMAXIMIZED 3

#ifndef XPP
   #define  HKEY_CLASSES_ROOT       2147483648
   #define  HKEY_CURRENT_USER       2147483649
   #define  HKEY_LOCAL_MACHINE      2147483650
   #define  HKEY_USERS              2147483651
   #define  HKEY_PERFORMANCE_DATA   2147483652
   #define  HKEY_CURRENT_CONFIG     2147483653
   #define  HKEY_DYN_DATA           2147483654
#else
   #define  HKEY_CLASSES_ROOT       1
   #define  HKEY_CURRENT_USER       2
   #define  HKEY_LOCAL_MACHINE      3
   #define  HKEY_USERS              4
   #define  HKEY_PERFORMANCE_DATA   5
   #define  HKEY_CURRENT_CONFIG     6
   #define  HKEY_DYN_DATA           7
#endif

#define SUCCESS_SUCCESS                      0
#define MAPI_USER_ABORT                      1
#define MAPI_E_FAILURE                       2
#define MAPI_E_LOGIN_FAILURE                 3
#define MAPI_E_DISK_FULL                     4
#define MAPI_E_INSUFFICIENT_MEMORY           5
#define MAPI_E_ACCESS_DENIED                 6
#define MAPI_E_TOO_MANY_SESSIONS             8
#define MAPI_E_TOO_MANY_FILES                9
#define MAPI_E_TOO_MANY_RECIPIENTS          10
#define MAPI_E_ATTACHMENT_NOT_FOUND         11
#define MAPI_E_ATTACHMENT_OPEN_FAILURE      12
#define MAPI_E_ATTACHMENT_WRITE_FAILURE     13
#define MAPI_E_UNKNOWN_RECIPIENT            14
#define MAPI_E_BAD_RECIPTYPE                15
#define MAPI_E_NO_MESSAGES                  16
#define MAPI_E_INVALID_MESSAGE              17
#define MAPI_E_TEXT_TOO_LARGE               18
#define MAPI_E_INVALID_SESSION              19
#define MAPI_E_TYPE_NOT_SUPPORTED           20
#define MAPI_E_AMBIGUOUS_RECIPIENT          21
#define MAPI_E_MESSAGE_IN_USE               22
#define MAPI_E_NETWORK_FAILURE              23
#define MAPI_E_INVALID_EDITFIELDS           24
#define MAPI_E_INVALID_RECIPS               25
#define MAPI_E_NOT_SUPPORTED                26

... Continua
 
Saludos.
João Santos - São Paulo - Brasil
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Re: Includes en .prg

Post by Compuin »

Gracias

La idea es no crear archivos .ch
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Includes en .prg

Post by cnavarro »

A ver si te he entendido

Code: Select all

// Por ejemplo
#ifndef CLR_LGRAY
#Define CLR_LGRAY      nRGB( 230, 230, 230 )
#endif
 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Re: Includes en .prg

Post by Compuin »

cnavarro wrote:A ver si te he entendido

Code: Select all

// Por ejemplo
#ifndef CLR_LGRAY
#Define CLR_LGRAY      nRGB( 230, 230, 230 )
#endif
 
Algo como esto:

Code: Select all

#INCLUDE "FiveWin.ch"

FUNCTION Main()

   LOCAL oDlg
   LOCAL cGet := 'Code   '
   LOCAL dGet := Date()

//   SET 3D ON

   SET DATE ITALIAN

   DEFINE DIALOG oDlg  TITLE "TBmpGet"

#command @ <nRow>, <nCol> BMPGET [ <oGet> VAR ] <uVar> ;
            [ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
            [ PICTURE <cPict> ] ;
            [ VALID <uValid> ] ;
            [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
            [ SIZE <nWidth>, <nHeight> ]  ;
            [ FONT <oFont> ] ;
            [ <design: DESIGN> ] ;
            [ CURSOR <oCursor> ] ;
            [ <pixel: PIXEL> ] ;
            [ MESSAGE <cMsg> ] ;
            [ <update: UPDATE> ] ;
            [ WHEN <uWhen> ] ;
            [ <lCenter: CENTER, CENTERED> ] ;
            [ <lRight: RIGHT> ] ;
            [ ON CHANGE <uChange> ] ;
            [ <readonly: READONLY, NO MODIFY> ] ;
            [ <pass: PASSWORD> ] ;
            [ <lNoBorder: NO BORDER, NOBORDER> ] ;
            [ <help:HELPID, HELP ID> <nHelpId> ] ;
            [ <resource: NAME, RESNAME, RESOURCE> <cResName> ];
            [ ACTION <uAction> ] ;


   REDEFINE BMPGET cGet ID 101 OF oDlg ;
            RESOURCE "GET_BROWSE" ;
            ACTION MsgStop( Cancel() )

   REDEFINE BMPGET dGet ID 102 OF oDlg SPINNER ;
            RESOURCE "GET_CALENDAR" ;
            ACTION MsgStop( Cancel )

   @ 0,0 GET cGet OF oDLG 

   ACTIVATE DIALOG oDlg CENTER

RETURN NIL
xmanuel
Posts: 613
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla
Contact:

Re: Includes en .prg

Post by xmanuel »

Si es posible...
Pero dos cosas al respecto...
1.- Ponlo al principio de tu PRG por que si hay una definición previa tendrás problemas ya que usará el primero.
2.- Es poco elegante e ilegible.

Lo mejor es un include y usar lo que te dice Cristobal:
#ifdef
#undef
#define
etc
______________________________________________________________________________
Sevilla - Andalucía
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Re: Includes en .prg

Post by Compuin »

xmanuel wrote:Si es posible...
Pero dos cosas al respecto...
1.- Ponlo al principio de tu PRG por que si hay una definición previa tendrás problemas ya que usará el primero.
2.- Es poco elegante e ilegible.

Lo mejor es un include y usar lo que te dice Cristobal:
#ifdef
#undef
#define
etc
Muchas gracias a todos!!
Post Reply