none
Appcore.cpp 196 assertion in Dialog when moving from VC++ 6.0 to VS2017 RRS feed

  • Question

  • Debug Assertion Failed!

    Program: C:\WINDOWS\SYSTEM32\mfc140d.dll

    File:

    d:\agent\_work3\s\src\vctools\vc7libs\ship\atlmfc\src\mfc\appcore.cpp

    Line: 196

    For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.

    (Press Retry to debug the application)  

    I have an app developed in VC++ 6.0 , Windows XP x32 and I want to migrate to VS 2017, Windows 10 x64

    I tried registering TBarCode6.ocx using  TBarCode6.exe and regsvr32 - registration successful, but program crashes same way.

    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\mfc140d.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\combase.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp60.dll'
    Debug Assertion Failed!

    Program: C:\WINDOWS\SYSTEM32\mfc140d.dll
    File: d:\agent\_work\3\s\src\vctools\vc7libs\ship\atlmfc\src\mfc\appcore.cpp
    Line: 196

    For information on how your program can cause an assertion
    failure, see the Visual C++ documentation on asserts.

    (Press Retry to debug the application)
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\WinTypes.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\WinTypes.dll'

    Tuesday, April 23, 2019 8:37 AM

Answers

  • Hello,

    Thanks for post here.

    >>Program: C:\WINDOWS\SYSTEM32\mfc140d.dll
    File: d:\agent\_work\3\s\src\vctools\vc7libs\ship\atlmfc\src\mfc\appcore.cpp
    Line: 196

    AFAIK, if there are more than one class inherits from CWinApp or create more than one CWinApp object in the MFC project, it will cause this issue, because each application that uses the MFC can contain only one object inherited from CWinApp.  

    So check your project, and make sure that you don't have this problem first. I create a MDI project and add two object inherited from CWinApp, When I debug, it show me this:

    Best Wishes,

    Jack Zhang


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Altun Murat Tuesday, May 7, 2019 7:37 AM
    Wednesday, April 24, 2019 7:31 AM
    Moderator
  • Hello,

    >>Binary was not built with debug information.

    It's not an installation issue, the problem is, as the error message suggests, that you have not built your project with debug information.

    Try this:
    1) Goto Project->Properties
    2) Make sure "Configuration" at the top is "Debug"
    3) On the left, select "C/C++", then "General"
    4) On the right, change "Debug information format" to "Program Database for edit and continue (/ZI)"
    5) On the left, Select "Optimization"
    6) On the right, Change "Optimization" to "Disabled (/Od)"
    7) On the left, select "Code Generation"
    8) On the right, change "Runtime library" to "Multi-Threaded Debug (/MTd)"
    9) On the left, expand "Linker" and select "Debugging"
    10) On the right, change "Generate Debug info" to "
    Generate Debug Information (/DEBUG)"
    11) Rebuild your project.

    More details here.

    Best Wishes,

    Jack


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Altun Murat Tuesday, May 7, 2019 7:39 AM
    Monday, May 6, 2019 5:58 AM
    Moderator

All replies

  • Hello,

    Thanks for post here.

    >>Program: C:\WINDOWS\SYSTEM32\mfc140d.dll
    File: d:\agent\_work\3\s\src\vctools\vc7libs\ship\atlmfc\src\mfc\appcore.cpp
    Line: 196

    AFAIK, if there are more than one class inherits from CWinApp or create more than one CWinApp object in the MFC project, it will cause this issue, because each application that uses the MFC can contain only one object inherited from CWinApp.  

    So check your project, and make sure that you don't have this problem first. I create a MDI project and add two object inherited from CWinApp, When I debug, it show me this:

    Best Wishes,

    Jack Zhang


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Altun Murat Tuesday, May 7, 2019 7:37 AM
    Wednesday, April 24, 2019 7:31 AM
    Moderator
  • Hello

    Thanks for the reply.

    I search for more than one CWinApp object in the MFC project, but I don't know how to remove them.

    I attach the next triggered breakpoint.

    CWinApp::CWinApp(LPCTSTR lpszAppName)
    {
    if (lpszAppName != NULL)
    m_pszAppName = _tcsdup(lpszAppName);
    else
    m_pszAppName = NULL;

    // initialize CWinThread state
    AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
    ENSURE(pModuleState);
    AFX_MODULE_THREAD_STATE* pThreadState = pModuleState->m_thread;
    ENSURE(pThreadState);
    ASSERT(AfxGetThread() == NULL);
    pThreadState->m_pCurrentWinThread = this;
    ASSERT(AfxGetThread() == this);
    m_hThread = ::GetCurrentThread();
    m_nThreadID = ::GetCurrentThreadId();

    // initialize CWinApp state
    ASSERT(afxCurrentWinApp == NULL); // only one CWinApp object please
    pModuleState->m_pCurrentWinApp = this;
    ASSERT(AfxGetApp() == this);

    // in non-running state until WinMain
    m_hInstance = NULL;
    m_hLangResourceDLL = NULL;
    m_pszHelpFilePath = NULL;
    m_pszProfileName = NULL;
    m_pszRegistryKey = NULL;
    m_pszExeName = NULL;
    m_pszAppID = NULL;
    m_pRecentFileList = NULL;
    m_pDocManager = NULL;
    m_atomApp = m_atomSystemTopic = NULL;
    m_lpCmdLine = NULL;
    m_pCmdInfo = NULL;
    m_pDataRecoveryHandler = NULL;

    // initialize wait cursor state
    m_nWaitCursorCount = 0;
    m_hcurWaitCursorRestore = NULL;

    // initialize current printer state
    m_hDevMode = NULL;
    m_hDevNames = NULL;
    m_nNumPreviewPages = 0;     // not specified (defaults to 1)

    // initialize DAO state
    m_lpfnDaoTerm = NULL;   // will be set if AfxDaoInit called

    // other initialization
    m_bHelpMode = FALSE;
    m_eHelpType = afxWinHelp;
    m_nSafetyPoolSize = 512;        // default size

    m_dwRestartManagerSupportFlags = 0;    // don't support Restart Manager by default
    m_nAutosaveInterval = 5 * 60 * 1000;   // default autosave interval is 5 minutes (only has effect if autosave flag is set)

    m_bTaskbarInteractionEnabled = TRUE;

    // Detect the kind of OS:
    OSVERSIONINFO osvi;
    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

    // Fix for warnings when building against WinBlue build 9444.0.130614-1739
    // warning C4996: 'GetVersionExW': was declared deprecated
    // externalapis\windows\8.1\sdk\inc\sysinfoapi.h(442)
    // Deprecated. Use VerifyVersionInfo* or IsWindows* macros from VersionHelpers.
    #pragma warning( disable : 4996 )
    ::GetVersionEx(&osvi);
    #pragma warning( default : 4996 )

    m_bIsWindows7 = (osvi.dwMajorVersion == 6) && (osvi.dwMinorVersion >= 1) || (osvi.dwMajorVersion > 6);

    // Taskbar initialization:
    m_bComInitialized = FALSE;

    m_pTaskbarList = NULL;
    m_pTaskbarList3 = NULL;
    m_bTaskBarInterfacesAvailable = TRUE;
    }
    • Edited by Altun Murat Wednesday, April 24, 2019 11:43 AM
    Wednesday, April 24, 2019 11:31 AM
  • TcbApl.h

    class AFX_EXT_CLASS CTcbApp : public CWinApp
    {
    public:
    CTcbBdd* Bdd() {return &gBasDat;}
    CParame oParame;
    protected:
    CTcbBdd gBasDat;
    virtual BOOL InitInstance() {return TRUE;};
    BOOL InitInstance(LPCTSTR nombre,bool tamano=false);
    private:
    virtual int ExitInstance();
    };
    class AFX_EXT_CLASS CTcbBat : public CWinApp
    {
    public:
    CTcbBdd* Bdd() {return &gBasDat;}
    CParame oParame;
    protected:
    CTcbBdd gBasDat;
    virtual BOOL InitInstance() {return TRUE;};
    BOOL InitInstance(LPCTSTR nombre,bool tamano=false);
    private:
    virtual int ExitInstance();
    }

    TcbApl.cpp

    int CTcbApp::ExitInstance()
    {
    gBasDat.Close();
    return CWinApp::ExitInstance();
    }

    int CTcbBat::ExitInstance()
    {
    gBasDat.Close();
    return CWinApp::ExitInstance();
    }

    CTcbReloj::CTcbReloj():CWaitCursor()
    {
    CWinApp* app=AfxGetApp();
    CTcbMar* marcos=(CTcbMar*)app->m_pMainWnd;
    CTcbPan* opcion=marcos->wOpcion;
    opcion->TcbReloj(true);
    }
    CTcbReloj::CTcbReloj(LPCTSTR textos):CWaitCursor()
    {
    CWinApp* app=AfxGetApp();
    CTcbMar* marcos=(CTcbMar*)app->m_pMainWnd;
    CTcbPan* opcion=marcos->wOpcion;
    opcion->TcbReloj(true,textos);
    }
    CTcbReloj::~CTcbReloj()
    {
    CWinApp* app=AfxGetApp();
    CTcbMar* marcos=(CTcbMar*)app->m_pMainWnd;
    CTcbPan* opcion=marcos->wOpcion;
    opcion->TcbReloj(false);
    }

    Wednesday, April 24, 2019 12:54 PM
  • Hello,

    >> I search for more than one CWinApp object in the MFC project, but I don't know how to remove them.

    I'm not sure how do you use the CTcbApp or CTcbBat class, you could check your code and make sure that you don't create objects of CTcbApp and CTcbBat at the same time, or maybe two objects of CTcbApp or CTcbBat. Error scenarios maybe like these:

    //scenario 1:
    CTcbApp cta;
    CTcbBat ctb; // error only one CWinApp object please
    
    //scenario 2:
    CTcbApp cta1;
    CTcbApp cta2;// error only one CWinApp object please
    
    //scenario 3:
    CTcbBat ctb1;
    CTcbBat ctb2;// error only one CWinApp object please
    ...

    So, if you encounter one of these, I think you could delete the one which was superfluous. If not, show more details about how do you use the  CTcbApp and CTcbBat in your application.

    Best Wishes,

    Jack Zhang


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Altun Murat Tuesday, May 7, 2019 7:36 AM
    • Unmarked as answer by Altun Murat Tuesday, May 7, 2019 7:36 AM
    Thursday, April 25, 2019 2:28 AM
    Moderator
  • /*****************************************************************************************/
    /*						               TcbApl.h                                          */
    /*					                                                                     */
    /*		Clases estructurales Windows (TcbApp, TcbMar, TcbPan, TcbMen, TcbOpc, TcbEst)    */
    /*		                                                                                 */
    /*****************************************************************************************/
    #define TCBBAT(nombre) BOOL CAresB::InitInstance(){m_pMainWnd=new CMarcosB();CTcbBat::InitInstance(nombre);return TRUE;}
    #define INI_BATCH(nombre) TCBBAT(nombre); bool CMarcosB::Opcion(UINT nOpcion) {switch(nOpcion)	{
    #define FIN_BATCH() default: return false;} return true;}
    #ifdef TCBGRANDE
    #define TCBAPL(nombre) BOOL CAres::InitInstance(){m_pMainWnd=new CMarcos();CTcbApp::InitInstance(nombre,true);return TRUE;}
    #else
    #define TCBAPL(nombre) BOOL CAres::InitInstance(){m_pMainWnd=new CMarcos();CTcbApp::InitInstance(nombre);return TRUE;}
    #endif
    #define INI_OPCION(nombre) TCBAPL(nombre); bool CMarcos::Opcion(UINT nOpcion,bool bOpcion) {switch(nOpcion)	{
    #define OPCION(idd) case 1##idd: wOpcion=new P##idd(); break;
    #define FIN_OPCION() default: AfxMessageBox("Opción deshabilitada. Consulte con el administrador de la aplicación."); return false;} return true;}
    #define PANTALLA(nombre) class nombre : public CTcbPan {private: void Inicio();void Pantalla();
    #define FIN_PANTALLA()	DECLARE_MESSAGE_MAP();};
    #define MAPA(nombre) BEGIN_MESSAGE_MAP(nombre,CTcbPan)
    #define FIN_MAPA() END_MESSAGE_MAP()
    
    #define INI_TCBTAB(a)	void a::IniTab(){
    #define USA_TCBTAB(a,b)	{w##a=new a;w##a->Create(IDD_##a,this);wTcbTab.InsertaDlg(b,w##a);}
    #define FIN_TCBTAB()	}
    #define DEF_TCBTAB()	void IniTab();CTcbTab wTcbTab;
    #define TCBTAB(a)		a	*w##a;
    #define Dm_i 1
    #define Dm_d 2
    #define Dm_a 4
    #define Dm_b 8
    
    #define Bdd_Hpp
    class AFX_EXT_CLASS CTcbReloj : public CWaitCursor
    {
    public:
    	CTcbReloj();
    	CTcbReloj(LPCTSTR textos);
    	~CTcbReloj();
    };
    class CParame : public CCommandLineInfo
    {
    public:
    	CParame() {bEmpres='0';bBasDat='0';bMenues=0;bTcbMen=1;}
    	char bEmpres;
    	char bBasDat;
    	int  bMenues;
    	int  bTcbMen;
    	long opcion;
    	void ParseParam(LPCSTR tParame,BOOL bFlag,BOOL bLast);
    };
    class AFX_EXT_CLASS CTcbApp : public CWinApp
    {
    public:
    	CTcbBdd* Bdd() {return &gBasDat;}
    	CParame oParame;
    protected:
    	CTcbBdd gBasDat;
    	virtual BOOL InitInstance() {return TRUE;};
    	BOOL InitInstance(LPCTSTR nombre,bool tamano=false);
    private:
    	virtual int ExitInstance();
    };
    /*class AFX_EXT_CLASS CTcbBat : public CWinApp
    {
    public:
    	CTcbBdd* Bdd() {return &gBasDat;}
    	CParame oParame;
    protected:
    	CTcbBdd gBasDat;
    	virtual BOOL InitInstance() {return TRUE;};
    	BOOL InitInstance(LPCTSTR nombre,bool tamano=false);
    private:
    	virtual int ExitInstance();
    }*/
    class AFX_EXT_CLASS CModulo
    {
    public:
    	CModulo() {wModulo=NULL;};
    	static CTcbBdd* gBasDat;
    	static CString tUsuari;
    	static long bIdioma;
    	struct {CString tTextos;int bTextos;long nNumero;long pNumero;CString tInform;} ePlanin;
    	CModulo* wModulo;
    	virtual bool Procesa(CString tParame) {return true;}
    	bool PonTarea(long modulo,CTcbHor fechas,CString parame=CString());
    	void PonAyuda(LPCTSTR ayuda) {};
    protected:
    	bool Calculo() {return true;};
    	bool Calculo2() {return true;};
    	bool Informe() {return true;};
    	bool Informe2() {return true;};
    	bool CalculoCombo() {return true;};
    	long Identity() {return gBasDat->Identity();}
    	void Ejecuta(CString tSelect) {gBasDat->Ejecuta(tSelect);}
    	CString Usuario() {return tUsuari;};
    	CString DameCamino(long codigo,bool dir);
    	CString DameCamino(long codigo);
    	void DameCamino(CString& camino);
    	void PasaOpcion(CModulo* modulo) {wModulo=modulo;};
    	void Refres() {};
    };
    class AFX_EXT_CLASS CTcbPan: public CDialog, public CModulo
    {
    protected:
      	CTcbPan();
    	CDataExchange* pDX;
    	CBrush oColor1,oColor2,oColor3,oColor4,oColor5;
    	CFont oFueNeg;
    	CTcbLis	wListas;
    	bool bPrimer;
    	int	bAccion;
    	int nSelecc;
    	UINT nIdcAnt,nIdcAct;
    	bool bTcbPro;
    	bool bCtlErr;
    	long nMaxPro;
    	long nNumPro;
    	int nListas[4];
    	CRect rListas[4];
    	CPtrArray aAyudaT;
    	CUIntArray aAyudaI;
    public:
    	int bRetorn;
    	CTcbPan* wRetorn;
    	virtual bool OnSalida();
    	virtual void OnAcepta() {};
    	virtual void OnCancel() {};
    	virtual void OnNuevos() {};
    	virtual void OnCambia() {};
    	virtual void OnBorrar() {};
    	virtual void OnBuscar() {};
    	virtual void OnListar() {};
    	virtual void OnImprim() {};
    	virtual void OnEjecut() {};
    	virtual void OnConsul() {};
    	virtual void OnAvanza();
    	virtual void OnVuelve();
    	virtual void OnTermin() {};
    	virtual void OnPrevio() {};
    	virtual void OnAnular() {};
    	virtual void OnSelecc() {};
    	virtual void OnCalcul() {};
    	virtual void OnGrabar() {};
    	virtual void OnEnviar() {};
    	virtual void OnProces() {};
    	virtual void OnFicher() {};
    	virtual void OnCheck(UINT posici,UINT estado) {};
    	void Mete() {UpdateData(TRUE);};
    	void Saca() {UpdateData(FALSE);};
    	virtual void Inicio() {};
    	virtual void Reinicio() {};
    	virtual void Retorno() {};
    	virtual bool SalOpcion(int idd) {return true;};
    	virtual bool OnValida(long col,long fil,long valor) {return true;}
    	virtual bool OnValida(long col,long fil,imp valor) {return true;}
    	virtual bool OnValida(long col,long fil,CString valor) {return true;}
    	virtual bool OnLeeDel(long fil,long num) {return true;}
    	bool PonError(UINT idc,LPCTSTR ayuda);
    	bool PonError(LPCTSTR ayuda);
    	void PonAyuda(LPCTSTR ayuda);
    	void QuitaAyuda();
    	void Esconde(UINT idc,int accion);
    	void HabTodo(int accion,UINT idc=0);
    	virtual void Pantalla() {};
    	void TcbReloj(bool ocupad,LPCTSTR textos=NULL);
    protected:
    	void OnOK();
    	void IniPro();
    	void AvanzaPro();
    	void FinPro();
    //	bool Calculo() {return true;};
    //	bool Calculo2() {return true;};
    //	bool Informe() {return true;};
    //	bool Informe2() {return true;};
    //	void CalculoCombo() {};
    	void Grafico() {};
    	void Dialogo(UINT nIDC);
    	void DialogoR(UINT nIDC);
    //	void Siguiente();
    //	bool Anterior();
    	void OnSeleccx();
    	void PonBoton(UINT nIDD0=0,UINT nIDD1=0,UINT nIDD2=0,UINT nIDD3=0,UINT nIDD4=0,UINT nIDD5=0,UINT nIDD6=0,UINT nIDD7=0,UINT nIDD8=0,UINT nIDD9=0,UINT nIDDA=0,UINT nIDDB=0,UINT nIDDC=0);
    	void PonOpcion(int cOpcion,UINT nIDD0=0,UINT nIDD1=0,UINT nIDD2=0,UINT nIDD3=0,UINT nIDD4=0,UINT nIDD5=0,UINT nIDD6=0,UINT nIDD7=0,UINT nIDD8=0,UINT nIDD9=0,UINT nIDDA=0,UINT nIDDB=0,UINT nIDDC=0);
    	void DesDialogo();
    	void Hab(int nIDD,bool hab=true);
    	void Habilita(UINT* nIDD);
    	void DesHabilita(UINT* nIDD);
    	void CreaMarco();
    	int LeeRadio(UINT nIDC,int n);
    	void PonRadio(UINT nIDC,int max,int radio);
    	CString TextCombo(long nIDC);
    	void Refres();
    	void IniImp();
    	BOOL OnInitDialog();
    	void DoDataExchange(CDataExchange* pdx);
    	HBRUSH OnCtlColor(CDC* pDC,CWnd* pWnd,UINT nCtlColor);
    	BOOL PreTranslateMessage(MSG* pMsg);
    	void OnSetFocus(UINT id);
    	void OcultaOpcion(bool estado);
    	virtual void PostNcDestroy();
    	long Identity() {return gBasDat->Identity();}
    	void Ejecuta(CString tSelect) {gBasDat->Ejecuta(tSelect);}
    	void SelOpcion(UINT nEvento);
    	int BuscaDim(int idc);
    	void TomaDim(int idc1,int idc2=0,int idc3=0,int idc4=0);
    	void Dimensiona(int idc1,int idc2=0,long fl=0);
    	void PonIdioma(CWnd* wnd);
    	void Empresa(CString inicia,CString nombre,CString rotulo);
    	void TextAyuda(UINT idc,LPCTSTR textos);
    	void PonGrande(bool tamano);
    	LPCTSTR BuscaTextAyuda(UINT idc);
    //	CString Usuario();
    //	CString DameCamino(long codigo,bool dir);
    //	CString DameCamino(long codigo);
    //	void DameCamino(CString& camino);
    	DECLARE_MESSAGE_MAP()
    };
    class DTCB_Planin:public CTcbRec
    {
    public:
    	CString tParame;
    	CString tTextos;
    	CString tNotifi;
    	CTcbHor fTareas;
    	CTcbHor fEjecuc;
    	long iPlanin;
    	long bPlanin;
    	long cModulo;
    	long bDiaPla;
    	long cOrigen;
    	long bTextos;
    	long bEstado;
    	DTCB_Planin(char* nombre);
    };
    class DTCB_Usuari:public CTcbRec
    {
    public:
    	CString tUsuari;		// Identificador de Usuario
    	CString tNombre;		// Nombre de Usuario
    	long cGrupos;		// Grupo al que pertenece
    	long bIdioma;		// Idioma que prefiere el usuario
    //	long bMenues;		// Tipo de menú
    	DTCB_Usuari(char* nombre);
    };
    class DTCB_Opcion:public CTcbRec
    {
    public:
    	long cGrupos;		// Grupo de Usuarios
    	long cTipMen;		// Tipo de Menu
    	long cAreas0;		// Codigo de Area
    	long cOpcion;		// Codigo de Opcion
    	long cOrdena;		// Codigo de Orden
    	DTCB_Opcion(char* nombre);
    };
    class AFX_EXT_CLASS DTCB_Rotulo:public CTcbRec
    {
    public:
    	long cCodigo;			// Codigo de	Opcion			1xxx,
    							//				Grupo			2xxx,
    							//				Area			3xxx,
    							//				Tipo de Menu	4xxx
    	CString tTitulo;		// Titulo
    	DTCB_Rotulo(char* nombre);
    };
    class DTCB_Areas0:public CTcbRec
    {
    public:
    	long cAreas0;			// Codigo de Area
    	CString tTitulo;		// Titulo
    	DTCB_Areas0(char* nombre);
    };
    class CTcbMen2:public CStatic
    {
    public:
    	CString tSistem;
    	CString tBasDat;
    	void OnPaint();
    	DECLARE_MESSAGE_MAP()
    };
    class CTcbMen: public CDialog, public CModulo
    {
    public:
    	CTcbMen(CWnd* pParent,int menues,int tipMen);
    	int bTipMen;
    private:
    	CTcbIco	wAreas0[8];
    	CTcbIco	wOpcion[24];
    	CTcbIco	wFinali;
    	CBrush oColorA;
    //	CFont oLetraA;
    //	CFont oLetraB;
    	CTcbMen2 wTitulo;
    	int aAreas0[15];
    	int aOpcion[24];
    	int nOpcion;
    	int nAreas0;
    	int iAreas0;
    	int iOpcion;
    	int kAreas0;
    	int kOpcion;
    	int bMenues;
    	char tSistem[200];
    	BOOL OnInitDialog();
    	void OnPaint();
    //	void Pinta1(int h);
    //	void Pinta2(int h);
    	void LeeUsuari();
    	void LlenaArea();
    	void LlenaArea1();
    	void OnAreas(UINT);
    	void OnAreas1(int);
    	void OnAreas2();
    	void OnAreas();
    	void OnOpcion(UINT);
    //	void Letras();
    	void Pagina(int n);
    //	void Pagina1(int n);
    	void Avanza(int n);
    	void Refres() {};
    	void OnOK();
    	void OnCancel() {};
    	void OnFinali();
    	void OnAgenda();
    	virtual void PostNcDestroy();
    	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
    	HBRUSH OnCtlColor(CDC* pDC,CWnd* pWnd,UINT nCtlColor);
    	BOOL PreTranslateMessage(MSG* pMsg);
    	DECLARE_MESSAGE_MAP()
    };
    class CTcbAcc: public CDialog
    {
    public:
    	CTcbAcc(CWnd* pParent);
    	void PonBoton(UINT nIDD0=0,UINT nIDD1=0,UINT nIDD2=0,UINT nIDD3=0,UINT nIDD4=0,UINT nIDD5=0,UINT nIDD6=0,UINT nIDD7=0,UINT nIDD8=0,UINT nIDD9=0,UINT nIDDA=0,UINT nIDDB=0,UINT nIDDC=0);
    	void PonOpcion(int cOpcion,UINT nIDD0=0,UINT nIDD1=0,UINT nIDD2=0,UINT nIDD3=0,UINT nIDD4=0,UINT nIDD5=0,UINT nIDD6=0,UINT nIDD7=0,UINT nIDD8=0,UINT nIDD9=0,UINT nIDDA=0,UINT nIDDB=0,UINT nIDDC=0);
    	void QuitaOpcion();
    	void OnCancel() {};
    	void OnOK() {};
    	void Selecc(int selecc);
    	void OcultaOpcion(bool estado);
    	void OcultaOpcion(UINT idc,bool estado);
    	void LimpiaOpcion() {for (int n=0;n<14;n++) bOpcion[n]=0;OcultaOpcion(true);kBotons=13;}
    	void ActivaOpcion(int opcion,int estado);
    	void InsertaOpcion(UINT nIDD,int po);
    	void OnBotons(UINT nIDD);
    	void OnOpcion(UINT nIDD);
    private:
    	CTcbIco	wBoton[14];
    	WORD aBotons[14];
    	long bOpcion[14];
    	long kBotons;
    	bool bOculta;
    	int	nBotons;
    	int	mBotons;	
    	int	iOpcion;
    	int	kOpcion;
    	int	nOpcion1;
    	int	nOpcion2;
    	int	nOpcion3;
    	int	xOpcion;
    	int cOpcion;
    	int	nAltura;
    	int nSelecc;
    	DTCB_Rotulo dOpcion;
    	void PonBoton_(UINT nIDD);
    	void PonOpcion_(UINT nIDD);
    	void OnSetFocus(CWnd* wnd);
    	void PintaOpcion(CDC& dc,int n);
    	BOOL OnInitDialog();
    	void OnPaint();
    	virtual void PostNcDestroy();
    	virtual void DoDataExchange(CDataExchange* pDX);
    	DECLARE_MESSAGE_MAP()
    };
    class CTcbEst: public CDialog
    {
    public:
    	CTcbEst();
    	void PonAyuda(LPCTSTR ayuda,bool errors=false);
    	void PonAyuda(UINT nIDC);
    	void QuitaAyuda();
    	void IniPro(long maximo);
    	void AvanzaPro(long numero);
    	void TcbReloj(bool ocupad,LPCTSTR textos);
    	void FinPro();
    	void IniImp();
    	void FinImp();
    private:
    	CString tAyudas;
    	CBrush oColorA;
    	CFont oLetraA;
    	CFont oLetraB;
    	bool bErrors;
    	bool bOcupad;
    	bool bAyudas;
    	long nMaximo;
    	void OnImp();
    	void OnPdf();
    	void OnPan();
    	void OnFic();
    	void SelImp();
    	void PonImp();
    	void Letras();
    	void OnPaint();
    	BOOL OnInitDialog();
    	int Pinta(CDC& dc,CRect r);
    	virtual void PostNcDestroy();
    	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
    	HBRUSH OnCtlColor(CDC* pDC,CWnd* pWnd,UINT nCtlColor);
    	DECLARE_MESSAGE_MAP()
    };
    class AFX_EXT_CLASS CTcbMar : public CFrameWnd, public CModulo
    {
    public:
    	CTcbMar() {};
    	CTcbMar(int menues,int tipMen,CTcbBdd* basdat,long opcion=0);
    	void Empresa();
    	void PonGrande(bool grandes=true);
    protected:
    	void PonAyuda(UINT nIDC);
    	void PonBoton(UINT nIDD0=0,UINT nIDD1=0,UINT nIDD2=0,UINT nIDD3=0,UINT nIDD4=0,UINT nIDD5=0,UINT nIDD6=0,UINT nIDD7=0,UINT nIDD8=0,UINT nIDD9=0,UINT nIDDA=0,UINT nIDDB=0,UINT nIDDC=0);
    	void PonOpcion(int cOpcion,UINT nIDD0=0,UINT nIDD1=0,UINT nIDD2=0,UINT nIDD3=0,UINT nIDD4=0,UINT nIDD5=0,UINT nIDD6=0,UINT nIDD7=0,UINT nIDD8=0,UINT nIDD9=0,UINT nIDDA=0,UINT nIDDB=0,UINT nIDDC=0);
    	void OcultaOpcion(bool estado);
    	void PonBoton2(UINT nIDD);
    	void Siguiente();
    	void Return();
    	void Escape();
    //	void QuitaOpcion();
    	void PonDialogo1(UINT nIDD0);
    	void DesDialogo();
    	void OnAvanza();
    	void DialogoR(int nIDC);	
    	void OnVuelve(CTcbPan* retorn);
    	void Salida(int estado,CTcbPan* retorn);
    	void Anterior();
    	void Retorno(CTcbPan* retorn);
    	void PrimerOpcion(CTcbPan* retorn);
    	bool SalOpcion(int idd) {return wOpcion->SalOpcion(idd);}
    	void SelOpcion(UINT nEvento);
    	void CreaMarco0(LPCTSTR nombre,int menues,int tipMen,long opcion);
    	void Refres();
    protected:
    	CTcbMen* wMenues;
    	CTcbPan* wOpcion;
    	CTcbPan* wRetorn;
    	CTcbPan* wPrimer;
    	CTcbEst* wEstado;
    	CTcbAcc* wAccion;
    //	CTcbBdd* gBasDat;
    	CString tEmpres;
    //	CString tUsuari;
    	CString tInicia;
    //	UINT zOpcion;
    //	UINT yOpcion;
    //	UINT zOpcion;
    	UINT nReturn;
    	UINT nEscape;
    	bool bDialog;
    	int bIdioma;
    	int bRetorn;
    	int	bTipMen;
    	int	bMenues;
    	int mDialog;
    	int iDialog;
    	int cDialog;
    	int nDirect;
    	CString	tNomApp;
    	struct {int nDialog;CTcbPan* wDialog;} aDialog[20];
    protected:
    	CRect rMarcos;
    	CRect rAccion;
    	CRect rEstado;
    	CRect rOpcion;
    	void OnNcPaint();
    	BOOL OnNcActivate(BOOL estado);
    	void CreaMarco1();
    	void CreaMarco2();
    	LRESULT OnCheck(WPARAM posici,LPARAM estado);
    	virtual bool Opcion(UINT nOpcion,bool bOpcion=false)=0;
    	void OnOpcion(UINT nOpcion);
    	void OnOpcion0(UINT nOpcion);
    	void OnOpcion1(UINT nOpcion);
    	int  BuscaDialog(int nOpcion);
    	void OnAccion(UINT nAccion);
    	void OnEvento(UINT nEvento);
    	void OnSalida();
    	void OnFinali();
    	void OnClose();
    	void Dialog(int anteri);
    	virtual void Inicio() {};
    	friend CTcbApp;
    	friend CTcbMen;
    	friend CTcbPan;
    	friend CTcbAcc;
    	friend CTcbEst;
    	friend CTcbReloj;
    	DECLARE_MESSAGE_MAP()
    };
    class CTcbBat2:public CStatic
    {
    public:
    	CString tTitulo;
    	CString tEstado;
    	afx_msg void OnPaint();
    	DECLARE_MESSAGE_MAP()
    };
    class AFX_EXT_CLASS CTcbBat0 : public CFrameWnd,public CModulo
    {
    public:
    	CTcbBat0() {};
    	CTcbBat0(int menues,long opcion=0);
    protected:
    	CString	tNomApp;
    	CString tEmpres;
    	CModulo* wOpcion;
    	CTcbBat2 wTitulo;
    	int nDirect;
    	int nTiempo;
    	bool bExiste;
    protected:
    	void CreaMarco(LPCTSTR nombre,long opcion);
    	virtual bool Opcion(UINT nOpcion)=0;
    	virtual void Inicio() {};
    	void Procesa(UINT opcion);
    	void OnTimer(UINT nTimer);
    	void Planifica();
    	void OnSalida();
    	void OnFinali();
    	void OnClose();
    	friend CTcbBat;
    	DECLARE_MESSAGE_MAP()
    };
    class CAresB : public CTcbBat
    {
    private:
    	virtual BOOL InitInstance();
    };
    class CAres : public CTcbApp
    {
    private:
    	virtual BOOL InitInstance();
    };
    
    class CMarcos : public CTcbMar
    {
    public:
    	CMarcos() {};
    	void Empresa() {CTcbMar::Empresa();}
    	virtual bool Opcion(UINT nOpcion,bool bOpcion=false);
    	virtual void Inicio();
    };
    class CMarcosB : public CTcbBat0
    {
    public:
    	CMarcosB() {};
    	virtual bool Opcion(UINT nOpcion);
    	virtual void Inicio();
    };
    //extern CAres gAres;


    Thursday, April 25, 2019 5:46 AM
  • Thank you very much for your support
    Thursday, April 25, 2019 5:47 AM
  • Hello,

    Actually you don't need to remove the definition of the CTcbBat class since CTcbBat0 and CAresB were related to it, seems that the CAresB inherits from CTcbBat and CAres inherits from CTcbApp, so now you need pay attention to the CAresB and CAres objects on your .cpp file(maybe TcbApl.cpp file).  

    Best Wishes,

    Jack Zhang


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 25, 2019 8:48 AM
    Moderator
  • /*****************************************************************************************/
    /*                                       TcbApl.cpp                                      */
    /*					                                                                     */
    /*		Clases estructurales Windows (TcbApp, TcbMar, TcbPan, TcbMen, TcbOpc, TcbEst)    */
    /*		                                                                                 */
    /*****************************************************************************************/
    
    #include "TcbLib.h"
    #include <afxole.h>        	// MFC OLE classes
    #include <afxodlgs.h>      	// MFC OLE dialog classes
    #include <afxdisp.h>       	// MFC OLE automation classes
    #define MARCOS ((CTcbMar*)GetParentFrame())
    #define ACCION ((CTcbMar*)GetParentFrame())->wAccion
    #define ESTADO ((CTcbMar*)GetParentFrame())->wEstado
    DTCB_Usuari dTCB_Usuari("TCB_Usuari");
    DTCB_Opcion dTCB_Opcion("TCB_Opcion");
    DTCB_Rotulo dTCB_Rotulo("TCB_Rotulo");
    DTCB_Areas0 dTCB_Areas0("TCB_Areas0");
    
    void CParame::ParseParam(LPCSTR tParame,BOOL bFlag,BOOL bLast)
    {
    	if (!bFlag) return;
    	if (tParame[0]=='E') bEmpres=tParame[1];
    	if (tParame[0]=='B') bBasDat=tParame[1];
    	if (tParame[0]=='P') bBasDat=tParame[0];
    	if (tParame[0]=='M') bTcbMen=tParame[1]-'0';
    	if (tParame[0]=='T') bMenues=tParame[1]-'0';
    	if (tParame[0]=='O') {tParame++; while (*tParame) opcion=opcion*10+*tParame++-'0';}
    }
    BOOL CTcbApp::InitInstance(LPCTSTR nombre,bool tamano)
    {
    	if (!AfxOleInit()) {AfxMessageBox("Fallo al iniciar OLE.");	return FALSE;}
    	setlocale(LC_ALL,"esp");
    	ParseCommandLine(oParame);
    	try
    	{
    		gBasDat.Abre(nombre,oParame.bEmpres,oParame.bBasDat);
    	}
    	catch(CDBException *e)
    	{
    		e->Delete();
    		return FALSE;
    	}
    	CModulo::gBasDat=&gBasDat;
    	CTcbPrn::IniImp();
    	CRect r(0,0,tamano?1024:800,tamano?738:574);
    	((CFrameWnd*)m_pMainWnd)->Create(NULL,nombre,WS_POPUP|WS_CAPTION|WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX,r);
    	if (oParame.bBasDat=='0')
    		m_pMainWnd->SetIcon(LoadIcon(TCB_APLICA),TRUE);
    	else
    		m_pMainWnd->SetIcon(LoadIcon(TCB_PRUEBA),TRUE);
    	m_pMainWnd->CenterWindow();
    	m_pMainWnd->ShowWindow(SW_SHOW);
    	m_pMainWnd->UpdateWindow();
    	((CTcbMar*)m_pMainWnd)->CreaMarco0(nombre,oParame.bMenues,oParame.bTcbMen,oParame.opcion);
    	return TRUE;
    }
    int CTcbApp::ExitInstance()
    {
    	gBasDat.Close();
    	return CWinApp::ExitInstance();
    }
    BOOL CTcbBat::InitInstance(LPCTSTR nombre,bool tamano)
    {
    	setlocale(LC_ALL,"esp");
    	ParseCommandLine(oParame);
    	gBasDat.bTcbBat=false;
    	try
    	{
    		gBasDat.Abre(nombre,oParame.bEmpres,oParame.bBasDat);
    	}
    	catch(CDBException *e)
    	{
    		e->Delete();
    		return FALSE;
    	}
    	CModulo::gBasDat=&gBasDat;
    	CTcbPrn::IniImp();
    	CRect r(GetSystemMetrics(SM_CXSCREEN)-600,GetSystemMetrics(SM_CYSCREEN)-200,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN)-30);
    	((CFrameWnd*)m_pMainWnd)->Create(NULL,nombre,WS_POPUP|WS_CAPTION|WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX,r);
    	m_pMainWnd->SetIcon(LoadIcon(TCB_APLICA),TRUE);
    	m_pMainWnd->ShowWindow(SW_MINIMIZE);
    	m_pMainWnd->UpdateWindow();
    	((CTcbBat0*)m_pMainWnd)->CreaMarco(nombre,oParame.opcion);
    	return TRUE;
    }
    int CTcbBat::ExitInstance()
    {
    	gBasDat.Close();
    	return CWinApp::ExitInstance();
    }
    DTCB_Planin::DTCB_Planin(char* nombre):CTcbRec(nombre)
    {
    	PonCampo("iPlanin",&iPlanin,Tv_i4|Cl_i);
    	PonCampo("bPlanin",&bPlanin,Tv_i4);
    	PonCampo("cModulo",&cModulo,Tv_i4);
    	PonCampo("bDiaPla",&bDiaPla,Tv_i4);
    	PonCampo("fTareas",&fTareas,Tv_ho);
    	PonCampo("tParame",&tParame,Tv_st);
    	PonCampo("cOrigen",&cOrigen,Tv_i4);
    	PonCampo("fEjecuc",&fEjecuc,Tv_ho);
    	PonCampo("tTextos",&tTextos,Tv_st);
    	PonCampo("bTextos",&bTextos,Tv_i4);
    	PonCampo("bEstado",&bEstado,Tv_i4);
    	PonCampo("tNotifi",&tNotifi,Tv_st);
    };
    DTCB_Planin dTCB_Planin("TCB_Planin");
    //////////////////////////////////////////////////////////////////////////////////
    // CTcbBat2
    //////////////////////////////////////////////////////////////////////////////////
    BEGIN_MESSAGE_MAP(CTcbBat2,CStatic)
    	ON_WM_PAINT()
    END_MESSAGE_MAP()
    void CTcbBat2::OnPaint()
    {
    	CPaintDC dc(this);
    	CRect oRectan;
    	GetClientRect(oRectan);
    	CBrush oPincel(RGB(244,248,137));
    	dc.FillRect(&oRectan,&oPincel);
    	oRectan.left+=2;
    	oRectan.right-=2;
    	CRect r1(oRectan),r2(oRectan);
    	r1.bottom/=2;
    	r2.top=r1.bottom;
    	CFont oLetra1;
    	CFont oLetra2;
    	oLetra1.CreateFont(-14,0,0,0,FW_NORMAL,0,0,0,0,0,0,0,0,"Arial");
    	oLetra2.CreateFont(-20,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"Arial");
    //	dc.SetTextColor(RGB(245,60,15));
    	dc.SetBkColor(RGB(244,248,137));
    	dc.SetBkMode(TRANSPARENT);
    	dc.SelectObject(&oLetra1);
    	dc.DrawText(tTitulo,r1,DT_LEFT|DT_TOP|DT_SINGLELINE);
    //	dc.DrawText(tBasDat,r1,DT_LEFT|DT_VCENTER|DT_SINGLELINE);
    //	dc.DrawText(s,r2,DT_LEFT|DT_VCENTER|DT_SINGLELINE);
    //	dc.DrawText(tSistem,r2,DT_RIGHT|DT_VCENTER|DT_SINGLELINE);
    //	dc.SelectObject(&oLetra2);
    //	dc.DrawText("Ares 2000",oRectan,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
    
    }
    //////////////////////////////////////////////////////////////////////////////////
    // CTcbBat0
    //////////////////////////////////////////////////////////////////////////////////
    BEGIN_MESSAGE_MAP(CTcbBat0,CFrameWnd)
    	ON_WM_TIMER()
    END_MESSAGE_MAP()
    void CTcbBat0::CreaMarco(LPCTSTR nombre,long opcion)
    {
    	tNomApp=nombre;
    	nDirect=opcion?opcion+1000:0;
    	nTiempo=30000;		// 5 minutos (5x60x1000) 300000
    	CRect r(0,0,800,500);
    	wTitulo.Create(_T(""),WS_VISIBLE,r,this);
    	Inicio();
    	if (nDirect) Procesa(nDirect); else OnTimer(0);
    }
    void CTcbBat0::OnTimer(UINT nTimer)
    {
    	if (nTimer) KillTimer(1);
    	bExiste=true;
    	Record(TCB_Planin);
    	BUCLEb("bEstado=0 AND bPlanin=2 AND fTareas<=SYSDATE","fTareas,iPlanin",Procesa(dTCB_Planin.cModulo));
    	BUCLEb("bEstado=0 AND bPlanin=1 AND fTareas<=SYSDATE","fTareas,iPlanin",Planifica());
    	if (SetTimer(1,nTiempo,NULL)==0) {/*AfxMesaggeBox("No se ha podido establecer la planificación.");*/ OnSalida();}
    	if (bExiste)
    	{
    		CString dia(BddTexto("SELECT SYSDATE FROM dual"));
    		wTitulo.tTitulo=dia+" No hay procedimientos pendiente de ejecución";
    		wTitulo.Invalidate();
    
    	}
    }
    void CTcbBat0::Procesa(UINT opcion)
    {
    	int errors;
    	CTcbPrn::nOpcion=opcion;
    	TCHAR update[1024];
    	if (Opcion(opcion))
    	{
    		CString titulo;
    		titulo.Format("SELECT tTitulo FROM TCB_Rotulo WHERE cCodigo=%d",opcion);
    		wTitulo.tTitulo.Format("AresBatch: [%s] %d - %s",BddTexto("SELECT SYSDATE FROM dual"),opcion,RotuloIdioma(BddTexto(titulo),1));
    		wTitulo.Invalidate();
    		errors=wOpcion->Procesa(dTCB_Planin.tParame)?1:2;
    		wsprintf(update,"UPDATE TCB_Planin SET fEjecuc=SYSDATE,bEstado=1,tTextos='%s',bTextos=%d WHERE iPlanin=%d",wOpcion->ePlanin.tTextos,errors,dTCB_Planin.iPlanin);
    		Ejecuta(update);
    		wTitulo.tTitulo+=errors==2?"(Error)":"(Correcto)";
    // santi, si el proceso no ha acabado correctamente y viene de una tarea planificada cOrigen<>0, se podría suspender la tarea planificada
    		wsprintf(update,"INSERT INTO Agenda VALUES (iAgenda.nextval,0,0,'AresBatch','%s','',SYSDATE,'31/12/2500','31/12/2500','%s',0,0,0,'%s',2,'','',0,0,0,0,'',0,0)"
    			,dTCB_Planin.tNotifi,wTitulo.tTitulo.Left(100),wOpcion->ePlanin.tTextos);
    		Ejecuta(update);
    		wTitulo.tTitulo+=" TERMINADO";
    		wTitulo.Invalidate();
    		bExiste=false;
    	}
    }
    void CTcbBat0::Planifica()
    {
    	TCHAR update[1024];
    	long planin=dTCB_Planin.iPlanin;
    	dTCB_Planin.tTextos.Empty();
    	dTCB_Planin.bPlanin=2;
    	dTCB_Planin.cOrigen=planin;
    	dTCB_Planin.bEstado=0;
    	BddNuevos(TCB_Planin);
    	CTcbDia hoy(DIAHOY);
    	while (dTCB_Planin.fTareas<=hoy)
    		switch (dTCB_Planin.bDiaPla)
    		{
    		case 1: dTCB_Planin.fTareas.SumDia(1); break;
    		case 2: dTCB_Planin.fTareas.SumDia(7); break;
    		case 3: dTCB_Planin.fTareas.SumMes(1); break;
    		case 4: dTCB_Planin.fTareas.SumMes(3); break;
    		case 5: dTCB_Planin.fTareas.SumAno(1); break;
    		default: dTCB_Planin.fTareas.Pon(DIANUL); break;
    		}
    	wsprintf(update,"UPDATE TCB_Planin SET fTareas=%s WHERE iPlanin=%d",dTCB_Planin.fTareas.Sql(),planin);
    	Ejecuta(update);
    }
    void CTcbBat0::OnSalida()
    {
    	if (nDirect) SendMessage(WM_CLOSE);
    }
    void CTcbBat0::OnClose()
    {
    	KillTimer(1);
    	CFrameWnd::OnClose();
    }
    //////////////////////////////////////////////////////////////////////////////////
    // CTcbMar
    //////////////////////////////////////////////////////////////////////////////////
    void CTcbMar::CreaMarco0(LPCTSTR nombre,int menues,int tipMen,long opcion)
    {
    //	gBasDat=CModulo::gBasDat;
    	bMenues=menues;
    	bTipMen=tipMen;
    	tNomApp=nombre;
    	nDirect=opcion?opcion+1000:0;
    	CMenu* sysmen = GetSystemMenu(FALSE);
    	if (sysmen != NULL)
    	{
    		for(int i=2; i<10; i++) sysmen->RemoveMenu(i, MF_BYPOSITION);
    //		CString abomen("About");
    //		sysmen->AppendMenu(MF_STRING, ID_ABOUT, abomen);
    	}
    	CreaMarco1();
    	CreaMarco2();
    	nReturn=0;
    	nEscape=0;
    	for (int n=0;n<20;n++) {aDialog[n].nDialog=0; aDialog[n].wDialog=NULL;}
    	mDialog=0;
    	cDialog=0;
    	bDialog=false;
    	wRetorn=NULL;
    	wPrimer=NULL;
    	bRetorn=0;
    	Inicio();
    	if (nDirect) SendMessage(WM_COMMAND,nDirect);
    }
    BEGIN_MESSAGE_MAP(CTcbMar,CFrameWnd)
    	ON_WM_CLOSE()
    	ON_COMMAND(TCB_FINALI,OnFinali)
    	ON_COMMAND_RANGE(TCB_PRIMER,TCB_ULTIMA,OnAccion)
    	ON_COMMAND_RANGE(IDD_PRIMER,IDD_ULTIMA,OnOpcion)
    	ON_COMMAND_RANGE(IDC_PRIMER,IDC_ULTIMO,OnEvento)
    	ON_COMMAND_RANGE(500,599,OnEvento)
    	ON_MESSAGE(WM_USER+1,OnCheck)
    	ON_WM_NCPAINT()
    	ON_WM_NCACTIVATE()
    END_MESSAGE_MAP()
    void CTcbMar::OnAccion(UINT nAccion)
    {
    	switch (nAccion)
    	{
    	case TCB_SALIDA: if (wOpcion->OnSalida()) OnSalida(); break;
    	case TCB_ACEPTA: wOpcion->OnAcepta(); break;
    	case TCB_CANCEL: wOpcion->OnCancel(); break;
    	case TCB_NUEVOS: wOpcion->OnNuevos(); break;
    	case TCB_CAMBIA: wOpcion->OnCambia(); break;
    	case TCB_BORRAR: wOpcion->OnBorrar(); break;
    	case TCB_BUSCAR: wOpcion->OnBuscar(); break;
    	case TCB_LISTAR: wOpcion->OnListar(); break;
    	case TCB_IMPRIM: wOpcion->OnImprim(); break;
    	case TCB_EJECUT: wOpcion->OnEjecut(); break;
    	case TCB_CONSUL: wOpcion->OnConsul(); break;
    	case TCB_AVANZA: wOpcion->OnAvanza(); break;
    	case TCB_VUELVE: wOpcion->OnVuelve(); break;
    	case TCB_TERMIN: wOpcion->OnTermin(); break;
    	case TCB_PREVIO: wOpcion->OnPrevio(); break;
    	case TCB_ANULAR: wOpcion->OnAnular(); break;
    	case TCB_CALCUL: wOpcion->OnCalcul(); break;
    	case TCB_GRABAR: wOpcion->OnGrabar(); break;
    	case TCB_ENVIAR: wOpcion->OnEnviar(); break;
    	case TCB_FICHER: wOpcion->OnFicher(); break;
    	}
    }
    LRESULT CTcbMar::OnCheck(WPARAM posici,LPARAM estado)
    {
    	wOpcion->OnCheck(posici,estado);
    	return 0;
    }
    void CTcbMar::OnNcPaint()
    {
    	CFrameWnd::OnNcPaint();
    	Empresa();
    }
    BOOL CTcbMar::OnNcActivate(BOOL estado)
    {
    	CFrameWnd::OnNcActivate(estado);
    	Empresa();
    	return TRUE;
    }
    void CTcbMar::Empresa()
    {
    	CWindowDC dc(this);
    	CRect rTitulo;
    	GetWindowRect(rTitulo);
    	ScreenToClient(rTitulo);
    	rTitulo.top=6;
    	dc.SetTextColor(RGB(255,255,255));
    	dc.SetBkMode(TRANSPARENT);
    	dc.DrawText(tEmpres,rTitulo,DT_CENTER);
    }
    void CTcbMar::CreaMarco1()
    {
    	GetClientRect(rMarcos);
    	rAccion=rMarcos;
    	rAccion.bottom=rAccion.top+80;
    	rEstado=rMarcos;
    	rEstado.top=rEstado.bottom-42;
    	rOpcion=rMarcos;
    	rOpcion.top=rAccion.bottom;
    	rOpcion.bottom=rEstado.top;
    }
    void CTcbMar::CreaMarco2()
    {
    	wOpcion=NULL;
    	wMenues=new CTcbMen(this,bMenues,bTipMen);
    	wMenues->Create(TCB_MENUES+bMenues,this);
    	if (!nDirect) wMenues->ShowWindow(SW_SHOW);
    	wAccion=new CTcbAcc(this);
    	wAccion->Create(TCB_ACCION,this);
    	wAccion->MoveWindow(rAccion);
    	wAccion->ShowWindow(SW_HIDE);
    	wEstado=new CTcbEst();
    	wEstado->Create(TCB_ESTADO,this);
    	wEstado->MoveWindow(rEstado);
    	wEstado->ShowWindow(SW_HIDE);
    	if (!nDirect) wMenues->SetFocus();
    }
    void CTcbMar::PonGrande(bool tamano)
    {
    	GetParentFrame();
    	MoveWindow(CRect(0,0,tamano?1024:800,tamano?738:574));
    	GetClientRect(rEstado);
    	rOpcion=rEstado;
    	rEstado.top=rEstado.bottom-42;
    	wEstado->MoveWindow(rEstado);
    	rOpcion.top+=80;
    	rOpcion.bottom=rEstado.top;
    }
    void CTcbMar::OnOpcion(UINT nOpcion)
    {
    	if (bRetorn==2) OnOpcion0(nOpcion); else
    	if (bDialog) OnOpcion1(nOpcion); else OnOpcion0(nOpcion);
    }
    void CTcbMar::OnOpcion0(UINT nOpcion)
    {
    	CTcbPrn::nOpcion=nOpcion;
    	if (wOpcion) wOpcion->DestroyWindow();
    	wOpcion=NULL;
    	wEstado->QuitaAyuda();	
    	CString titulo;
    	titulo.Format("%s %03d-%s",tInicia,dTCB_Rotulo.cCodigo%1000,RotuloIdioma(dTCB_Rotulo.tTitulo));
    	titulo.Replace('#',' ');
    //	yOpcion=nOpcion;
    	if (Opcion(nOpcion,true))
    	{
    		if (!nDirect) wMenues->ShowWindow(SW_HIDE);
    		wAccion->ShowWindow(SW_SHOW);
    		wEstado->ShowWindow(SW_SHOW);
    		wOpcion->wRetorn=NULL;
    		if (bRetorn==1) wOpcion->wRetorn=wPrimer;
    		if (bRetorn==2) wOpcion->wRetorn=wRetorn;
    		wOpcion->bRetorn=bRetorn;
    		wOpcion->Create(nOpcion,this);
    		wOpcion->MoveWindow(rOpcion);
    		wOpcion->ShowWindow(SW_SHOW);
    		wOpcion->SetFocus();
    //		wOpcion->Inicio();
    //		wOpcion->Pantalla();
    		wOpcion->UpdateData(FALSE);
    		SetWindowText(titulo);
    		Empresa();
    		wRetorn=NULL;
    		bRetorn=0;
    	}
    }
    void CTcbMar::OnOpcion1(UINT nOpcion)
    {
    	iDialog=BuscaDialog(nOpcion);
    	if (iDialog<0) return;
    	wOpcion->ShowWindow(SW_HIDE);
    	if (aDialog[iDialog].wDialog)
    	{
    		wOpcion=aDialog[iDialog].wDialog;
    		wOpcion->ShowWindow(SW_SHOW);
     		wOpcion->Reinicio();
    	}
    	else
    	{
    		if (cDialog>0) wAccion->ActivaOpcion(iDialog-1,1);
    		bRetorn=1;
    		wOpcion=NULL;
    		OnOpcion0(nOpcion);
    		aDialog[iDialog].wDialog=wOpcion;
    		if (iDialog==0) wRetorn=wOpcion;
    	}
    	wAccion->Selecc(iDialog-1);
    }
    int CTcbMar::BuscaDialog(int nOpcion)
    {
    	for (int n=0;n<mDialog;n++) if (aDialog[n].nDialog==nOpcion) return n;
    	return -1;
    }
    void CTcbMar::PonBoton2(UINT nIDD)
    {
    	switch (nIDD/10000)
    	{
    	case 1:	nReturn=nIDD%10000; break;
    	case 2:	nEscape=nIDD%10000; break;
    	}
    }
    void CTcbMar::Salida(int estado,CTcbPan* retorn)
    {
    	if (estado==2) Retorno(retorn); else
    	if (estado==1) PrimerOpcion(retorn); else OnSalida();
    }
    void CTcbMar::OnSalida()
    {
    	DesDialogo();
    	wEstado->FinImp();
    	wEstado->QuitaAyuda();	
    	wOpcion->DestroyWindow();
    	wOpcion=NULL;
    	if (nDirect)
    		SendMessage(WM_COMMAND,TCB_FINALI);
    	else
    	{
    		wAccion->ShowWindow(SW_HIDE);
    		wEstado->ShowWindow(SW_HIDE);
    		wMenues->ShowWindow(SW_SHOW);
    		wMenues->SetFocus();
    		SetWindowText(tInicia+tNomApp);
    		Empresa();
    	}
    	CTcbPrn::Copias(1);
    }
    void CTcbMar::OnFinali()
    {
    	SendMessage(WM_CLOSE);
    }
    void CTcbMar::OnClose()
    {
    	wAccion->DestroyWindow();
    	wEstado->DestroyWindow();
    	if (!nDirect) wMenues->DestroyWindow();
    	CFrameWnd::OnClose();
    }
    void CTcbMar::Return()
    {
    	if (nReturn) SendMessage(WM_COMMAND,nReturn);
    }
    void CTcbMar::Escape()
    {
    	if (nEscape) SendMessage(WM_COMMAND,nEscape);
    }
    void CTcbMar::SelOpcion(UINT nEvento)
    {
    	wAccion->Selecc(BuscaDialog(nEvento));
    }
    void CTcbMar::OnEvento(UINT nEvento)
    {
    	iDialog=BuscaDialog(nEvento);
    	if (iDialog>=0) wAccion->Selecc(iDialog);
    	wOpcion->SendMessage(WM_COMMAND,nEvento);
    }
    void CTcbMar::PonOpcion(int opcion,UINT nIDD0,UINT nIDD1,UINT nIDD2,UINT nIDD3,UINT nIDD4,UINT nIDD5,UINT nIDD6,UINT nIDD7,UINT nIDD8,UINT nIDD9,UINT nIDDA,UINT nIDDB,UINT nIDDC)
    {
    	cDialog=opcion;
    	iDialog=0;
    	DesDialogo();
    	PonDialogo1(nIDD0);
    	PonDialogo1(nIDD1);
    	PonDialogo1(nIDD2);
    	PonDialogo1(nIDD3);
    	PonDialogo1(nIDD4);
    	PonDialogo1(nIDD5);
    	PonDialogo1(nIDD6);
    	PonDialogo1(nIDD7);
    	PonDialogo1(nIDD8);
    	PonDialogo1(nIDD9);
    	PonDialogo1(nIDDA);
    	PonDialogo1(nIDDB);
    	PonDialogo1(nIDDC);
    	bDialog=true;
    	wAccion->PonOpcion(opcion,nIDD0,nIDD1,nIDD2,nIDD3,nIDD4,nIDD5,nIDD6,nIDD7,nIDD8,nIDD9,nIDDA,nIDDB,nIDDC);
    	wPrimer=wOpcion;
    }
    void CTcbMar::PonDialogo1(UINT nIDD)
    {
    	if (nIDD)
    	{
    		aDialog[mDialog].nDialog=nIDD;
    		aDialog[mDialog].wDialog=(nIDD/1000)==2?NULL:mDialog?NULL:wOpcion;
    		mDialog++;
    	}
    }
    void CTcbMar::DesDialogo()
    {
    	for (int n=0;n<mDialog;n++)
    		if (aDialog[n].wDialog)
    		{
    			if (aDialog[n].wDialog!=wOpcion) aDialog[n].wDialog->DestroyWindow();
    			aDialog[n].wDialog=NULL;
    		}
    	mDialog=0;
    	bDialog=false;
    	wPrimer=NULL;
    	wAccion->LimpiaOpcion();
    }
    void CTcbMar::Refres()
    {
        MSG msg;
        while(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
        {
    //        TranslateMessage(&msg);
      //      DispatchMessage(&msg);  
        }
    }
    void CTcbMar::OnAvanza()
    {
    //	Refres();
    	if (bDialog)
    	{
    		wAccion->EnableWindow(FALSE);
    		int anteri=iDialog;
    		int actual=iDialog;
    		if (actual<mDialog-1) actual++;
    		if (actual!=anteri) if (SalOpcion(1)) {iDialog=actual; Dialog(anteri);}
    		wAccion->EnableWindow(TRUE);
    	}
    }
    void CTcbMar::OnVuelve(CTcbPan* retorn)
    {
    	Refres();
    	if (bDialog)
    	{
    		wAccion->EnableWindow(FALSE);
    		int anteri=iDialog;
    		int actual=iDialog;
    		if (actual) actual--;
    		if (actual!=anteri) if (SalOpcion(2)) {iDialog=actual; Dialog(anteri);}
    		wAccion->EnableWindow(TRUE);
    	}
    	else
    		if (retorn) Retorno(retorn);
    }
    void CTcbMar::DialogoR(int nOpcion)
    {
    	wOpcion->ShowWindow(SW_HIDE);
    	wRetorn=wOpcion;
    	wOpcion=NULL;
    	bRetorn=2;
    	OnOpcion(nOpcion);
    }
    void CTcbMar::Retorno(CTcbPan* retorn)
    {
    	wOpcion->DestroyWindow();
    	wOpcion=retorn;
    	wOpcion->ShowWindow(SW_SHOW);
    	wOpcion->Retorno();
    }
    void CTcbMar::PrimerOpcion(CTcbPan* retorn)
    {
    	wOpcion->ShowWindow(SW_HIDE);
    	wOpcion=retorn;
    	DesDialogo();
    	wOpcion->ShowWindow(SW_SHOW);
    	wOpcion->Reinicio();
    }
    void CTcbMar::Dialog(int anteri)
    {
    	aDialog[anteri].wDialog=wOpcion;
    	if (aDialog[iDialog].wDialog)
    	{
    		wOpcion->ShowWindow(SW_HIDE);
    		wOpcion=aDialog[iDialog].wDialog;
    		wOpcion->ShowWindow(SW_SHOW);
    		wOpcion->Reinicio();
    		wAccion->Selecc(iDialog-1);
    	}
    	else
    		OnOpcion(aDialog[iDialog].nDialog);
    }
    
    /////////////////////////////////////////////////////////////////////////////
    // CModulo
    /////////////////////////////////////////////////////////////////////////////
    CString CModulo::DameCamino(long codigo)
    {
    	CString select;
    	select.Format("SELECT tCamino FROM Camino WHERE cCamino=%d",codigo);
    	CString camino;
    	CRecordset oRecord(gBasDat);
    	oRecord.Open(CRecordset::snapshot,select,CRecordset::none);
    	if (!oRecord.IsEOF()) oRecord.GetFieldValue((short)0,camino);
    	oRecord.Close();
    	return camino;
    }
    void CModulo::DameCamino(CString& camino)
    {
    	int l1=camino.Find('[');
    	int l2=camino.Find(']');
    	if (l2<0) return;
    	CString partes=camino.Mid(l1+1,l2-l1-1);
    	camino.Delete(l1,l2-l1+1);
    	camino.Insert(l1,DameCamino(CTv::DameNumero(partes)));
    }
    CString CModulo::DameCamino(long codigo,bool dir)
    {
    	CString camino=DameCamino(codigo);
    	while (camino.Find('[')>=0) DameCamino(camino);
    	if (dir&&camino[camino.GetLength()-1]!='\\') camino+='\\';
    	return camino;
    }
    bool CModulo::PonTarea(long modulo,CTcbHor fechas,CString parame)
    {
    	dTCB_Planin.tParame=parame;
    	dTCB_Planin.tTextos.Empty();
    	dTCB_Planin.fTareas=fechas;
    	dTCB_Planin.fEjecuc.Pon(DIANUL);
    	dTCB_Planin.iPlanin=0;
    	dTCB_Planin.bPlanin=2;
    	dTCB_Planin.cModulo=modulo;
    	dTCB_Planin.bDiaPla=0;
    	dTCB_Planin.cOrigen=-1;
    	dTCB_Planin.bTextos=0;
    	dTCB_Planin.bEstado=0;
    	BddNuevos(TCB_Planin);
    	return true;
    }
    /////////////////////////////////////////////////////////////////////////////
    // CTcbPan 
    /////////////////////////////////////////////////////////////////////////////
    #define ROTULOa	RGB(110,110,110)
    #define ROTULOb	RGB(63,74,220)
    #define ROTULOc	RGB(50,220,230)
    #define FONDOSa	RGB(132,193,193)
    #define FONDOSb	RGB(176,176,217)
    #define BLANCOa	RGB(255,255,255)
    #define NEGROa	RGB(0,0,0)
    BEGIN_MESSAGE_MAP(CTcbPan,CDialog)
    	ON_WM_PAINT()
    	ON_LBN_SELCHANGE(IDC_LISTAS_LIS,OnSeleccx)
    	ON_CONTROL_RANGE(EN_SETFOCUS,IDC_PRIMER,IDC_ULTIMO,OnSetFocus)
    	ON_CONTROL_RANGE(CBN_SETFOCUS,IDC_PRIMER,IDC_ULTIMO,OnSetFocus)
    //	ON_CONTROL_RANGE(EN_KILLFOCUS,IDC_PRIMER,IDC_ULTIMO,OnKillFocus)
    //	ON_CONTROL_RANGE(CBN_KILLFOCUS,IDC_PRIMER,IDC_ULTIMO,OnKillFocus)
    	ON_WM_CTLCOLOR()
    END_MESSAGE_MAP()
    CTcbPan::CTcbPan():CDialog(),CModulo(),bPrimer(true)
    {
    	nIdcAnt=nIdcAct=0;
    	nMaxPro=nNumPro=0;
    	bTcbPro=false;
    	nSelecc=0;
    	oColor1.CreateSolidBrush(ROTULOa);
    	oColor2.CreateSolidBrush(ROTULOb);
    	oColor3.CreateSolidBrush(FONDOSa);
    	oColor4.CreateSolidBrush(FONDOSb);
    	oColor5.CreateSolidBrush(ROTULOc);
    	oFueNeg.CreateFont(-8,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"MS Sans Serif");
    	wRetorn=NULL;
    	bRetorn=0;
    }
    HBRUSH CTcbPan::OnCtlColor(CDC* pDC,CWnd* pWnd,UINT nCtlColor)
    {
    	if (nCtlColor!=CTLCOLOR_STATIC)	return CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
    	if ((pWnd->GetDlgCtrlID()/1000)!=6)	return CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
    	switch (pWnd->GetDlgCtrlID()/100%10)
    	{
    	case 0: pDC->SetBkColor(ROTULOa); pDC->SetTextColor(BLANCOa); return (HBRUSH)oColor1.GetSafeHandle();break;
    	case 1: pDC->SetBkColor(ROTULOb); pDC->SetTextColor(BLANCOa); return (HBRUSH)oColor2.GetSafeHandle();break;
    	case 2: pDC->SetBkColor(ROTULOc); pDC->SetTextColor(BLANCOa); return (HBRUSH)oColor5.GetSafeHandle();break;
    	case 6: pDC->SetBkColor(FONDOSa); pDC->SetTextColor(BLANCOa); return (HBRUSH)oColor3.GetSafeHandle();break;
    	case 7: pDC->SetBkColor(FONDOSb); pDC->SetTextColor(BLANCOa); return (HBRUSH)oColor4.GetSafeHandle();break;
    	}
    	return CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
    }
    void CTcbPan::PostNcDestroy()
    {
    	CDialog::PostNcDestroy();
    	delete this;
    }
    BOOL CTcbPan::OnInitDialog()
    {
    	char buffer[128];
    	CWnd* wnd=GetWindow(GW_CHILD);
    	while (wnd)
    	{
    		GetClassName(wnd->GetSafeHwnd(),buffer,sizeof(buffer));
    		if (strcmp(buffer,"Static")==0) PonIdioma(wnd);
    		if (strcmp(buffer,"Button")==0) PonIdioma(wnd);
    		wnd=wnd->GetWindow(GW_HWNDNEXT);
    	}
    	CDialog::OnInitDialog();
    	bCtlErr=true;
    	return FALSE;
    }
    void CTcbPan::PonIdioma(CWnd* wnd)
    {
    	CString rotulo;
    	wnd->GetWindowText(rotulo);
    	rotulo=RotuloIdioma(rotulo);
    	wnd->SetWindowText(rotulo);
    	if (wnd->GetDlgCtrlID()/1000%10==6) wnd->SetFont(&oFueNeg);
    }
    void CTcbPan::DoDataExchange(CDataExchange* pdx)
    {
    	pDX=pdx;
    	if (bPrimer) Inicio();
    	Pantalla();
    	bPrimer=false;
    }
    BOOL CTcbPan::PreTranslateMessage(MSG* pMsg)
    {
        if (pMsg->message==WM_KEYDOWN)
    	{
    		switch (pMsg->wParam)
    		{
    		case VK_F1:
    		case VK_F2:
    		case VK_F3:
    		case VK_F4:
    		case VK_F5:
    		case VK_F6:
    		case VK_F7:
    		case VK_F8: ACCION->OnBotons(TCB_BOTON0_BUT+12-pMsg->wParam+VK_F1); return TRUE; break;
    		case VK_RETURN: if (GetKeyState(VK_CONTROL)&0xF000) {MARCOS->Return(); return TRUE;} break;
    		case VK_ESCAPE: MARCOS->Escape(); return TRUE; break;
    		case VK_F12: return TRUE; break;
    		}
        }
    	return CDialog::PreTranslateMessage(pMsg);
    }
    void CTcbPan::OnSetFocus(UINT id)
    {
    	nIdcAct=id;
    	if (bCtlErr) ESTADO->PonAyuda(BuscaTextAyuda(id));
    	bCtlErr=true;
    }
    void CTcbPan::TextAyuda(UINT idc,LPCTSTR textos)
    {
    	if (bPrimer)
    	{
    		aAyudaI.Add(idc);
    		aAyudaT.Add((void*)textos);
    	}
    }
    LPCTSTR CTcbPan::BuscaTextAyuda(UINT idc)
    {
    	for (int n=0;n<aAyudaI.GetCount();n++) if (aAyudaI[n]==idc) return (LPTSTR)aAyudaT[n];
    	return NULL;
    }
    void CTcbPan::PonAyuda(LPCTSTR ayuda)
    {
    	ESTADO->PonAyuda(ayuda,false);
    	Refres();
    }
    bool CTcbPan::PonError(UINT idc,LPCTSTR ayuda)
    {
    	bCtlErr=false;
    	ESTADO->PonAyuda(ayuda,true);
    	GetDlgItem(idc)->SetFocus();
    	Refres();
    	return false;
    }
    bool CTcbPan::PonError(LPCTSTR ayuda)
    {
    	bCtlErr=false;
    	ESTADO->PonAyuda(ayuda,true);
    	Refres();
    	return false;
    }
    void CTcbPan::QuitaAyuda()
    {
    	ESTADO->QuitaAyuda();
    	Refres();
    }
    void CTcbPan::Hab(int nIDD,bool hab)
    {
    	(CWnd*)GetDlgItem(nIDD)->EnableWindow(hab);
    }
    void CTcbPan::Habilita(UINT* nIDD)
    {
    	while (*nIDD) Hab(*nIDD++,true);
    }
    void CTcbPan::DesHabilita(UINT* nIDD)
    {
    	while (*nIDD) Hab(*nIDD++,false);
    }
    void CTcbPan::PonBoton(UINT nIDD0,UINT nIDD1,UINT nIDD2,UINT nIDD3,UINT nIDD4,UINT nIDD5,UINT nIDD6,UINT nIDD7,UINT nIDD8,UINT nIDD9,UINT nIDDA,UINT nIDDB,UINT nIDDC)
    {
    	ACCION->PonBoton(nIDD0,nIDD1,nIDD2,nIDD3,nIDD4,nIDD5,nIDD6,nIDD7,nIDD8,nIDD9,nIDDA,nIDDB,nIDDC);
    }
    void CTcbPan::PonOpcion(int opcion,UINT nIDD0,UINT nIDD1,UINT nIDD2,UINT nIDD3,UINT nIDD4,UINT nIDD5,UINT nIDD6,UINT nIDD7,UINT nIDD8,UINT nIDD9,UINT nIDDA,UINT nIDDB,UINT nIDDC)
    {
    	MARCOS->PonOpcion(opcion,nIDD0,nIDD1,nIDD2,nIDD3,nIDD4,nIDD5,nIDD6,nIDD7,nIDD8,nIDD9,nIDDA,nIDDB,nIDDC);
    }
    void CTcbPan::DesDialogo()
    {
    	MARCOS->DesDialogo();
    }
    void CTcbPan::SelOpcion(UINT nEvento)
    {
    	MARCOS->SelOpcion(nEvento);
    }
    void CTcbPan::OcultaOpcion(bool estado)
    {
    	ACCION->OcultaOpcion(estado);
    }
    bool CTcbPan::OnSalida()
    {
    	MARCOS->Salida(bRetorn,wRetorn);
    	return false;
    }
    void CTcbPan::OnSeleccx()
    {
    	OnSelecc();
    }
    void CTcbPan::Dialogo(UINT nOpcion)
    {
    	MARCOS->SendMessage(WM_COMMAND,nOpcion);
    }
    void CTcbPan::DialogoR(UINT nOpcion)
    {
    	MARCOS->DialogoR(nOpcion);
    }
    void CTcbPan::IniPro()
    {
    	ESTADO->IniPro(nMaxPro);
    	bTcbPro=true;
    	nNumPro=0;
    }
    void CTcbPan::AvanzaPro()
    {
    	if (bTcbPro) ESTADO->AvanzaPro(++nNumPro);
    }
    void CTcbPan::FinPro()
    {
    	ESTADO->FinPro();
    	bTcbPro=false;
    	nNumPro=0;
    }
    void CTcbPan::TcbReloj(bool ocupad,LPCTSTR textos)
    {
    	ESTADO->TcbReloj(ocupad,textos);
    	Refres();
    }
    int CTcbPan::LeeRadio(UINT nIDC,int max)
    {
    	for (int n=0;n<max;n++) if (LeeCheck(nIDC+n)) return n;
    	return -1;
    }
    void CTcbPan::PonRadio(UINT nIDC,int max,int radio)
    {
    	CheckRadioButton(nIDC,nIDC+max,nIDC+radio);
    }
    CString CTcbPan::TextCombo(long idc)
    {
    	CString tx;
    	CComboBox* wCombo=(CComboBox*)GetDlgItem(idc);
    	int po=wCombo->GetCurSel();
    	if (po>=0) wCombo->GetLBText(po,tx);
    	return CString(tx);
    }
    void CTcbPan::IniImp()
    {
    	ESTADO->IniImp();
    }
    void CTcbPan::Refres()
    {
        MSG msg;
    	HCURSOR hcurPrev=::GetCursor();
        while(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);  
        }
    	::SetCursor(hcurPrev);
    }
    void CTcbPan::OnOK()
    {
    	((CTcbMar*)GetParentFrame())->Return();
    }
    void CTcbPan::OnAvanza() {MARCOS->OnAvanza();};
    void CTcbPan::OnVuelve() {MARCOS->OnVuelve(wRetorn);};
    void CTcbPan::TomaDim(int idc1,int idc2,int idc3,int idc4)
    {
    	if (idc1) {GetDlgItem(idc1)->GetWindowRect(rListas[0]); ScreenToClient(rListas[0]); nListas[0]=idc1;}
    	if (idc2) {GetDlgItem(idc2)->GetWindowRect(rListas[1]); ScreenToClient(rListas[1]); nListas[1]=idc2;}
    	if (idc3) {GetDlgItem(idc3)->GetWindowRect(rListas[2]); ScreenToClient(rListas[2]); nListas[2]=idc3;}
    	if (idc4) {GetDlgItem(idc4)->GetWindowRect(rListas[3]); ScreenToClient(rListas[3]); nListas[3]=idc4;}
    }
    int CTcbPan::BuscaDim(int idc)
    {
    	for (int n=0;n<4;n++) if (idc==nListas[n]) return n;
    	return -1;
    }
    void CTcbPan::Dimensiona(int idc1,int idc2,long fl)
    {
    	int n1=BuscaDim(idc1);
    	if (n1<0) return;
    	if (fl&&idc2)
    	{
    		int n2=BuscaDim(idc2);
    		if (n2<0) return;
    		CRect r1(rListas[n1]);
    		CRect r2(rListas[n2]);
    //		GetDlgItem(idc1)->GetWindowRect(r1);
    //		GetDlgItem(idc2)->GetWindowRect(r2);
    		if (fl&Dm_i) r1.left=r2.left;
    		if (fl&Dm_d) r1.right=r2.right;
    		if (fl&Dm_a) r1.top=r2.top;
    		if (fl&Dm_b) r1.bottom=r2.bottom;
    //		ScreenToClient(r1);
    		GetDlgItem(idc1)->MoveWindow(r1);
    	}
    	else
    		GetDlgItem(idc1)->MoveWindow(rListas[n1]);
    }
    void CTcbPan::Esconde(UINT idc,int accion)
    {
    	if (accion) accion=SW_SHOW;
    	CWnd* wnd=GetWindow(GW_CHILD);
    	while (wnd)
    	{
    		wnd->ShowWindow(wnd->GetDlgCtrlID()==idc?SW_SHOW-accion:accion);
    		wnd=wnd->GetWindow(GW_HWNDNEXT);
    	}
    }
    void CTcbPan::HabTodo(int accion,UINT idc)
    {
    	char buffer[128];
    	CWnd* wnd=GetWindow(GW_CHILD);
    	while (wnd)
    	{
    		GetClassName(wnd->GetSafeHwnd(),buffer,sizeof(buffer));
    		if (strcmp(buffer,"Static")!=0) wnd->EnableWindow(wnd->GetDlgCtrlID()==idc?1-accion:accion);
    		wnd=wnd->GetWindow(GW_HWNDNEXT);
    	}
    }
    void CTcbPan::Empresa(CString inicia,CString nombre,CString rotulo)
    {
    	CTcbPrn::tEmpres=nombre;
    	MARCOS->tInicia=inicia;
    	MARCOS->tEmpres=rotulo;
    	MARCOS->Empresa();
    }
    void CTcbPan::PonGrande(bool tamano)
    {
    	MARCOS->PonGrande(tamano);
    }
    /*****************************************************************************************/
    /*						               CTcbMen                                           */
    /*					                                                                     */
    /*	                                 	Menu                                             */
    /*		                                                                                 */
    /*****************************************************************************************/
    
    DTCB_Usuari::DTCB_Usuari(char* nombre):CTcbRec(nombre)
    {
    	PonCampo("tUsuari",&tUsuari,Tv_st|Cl_p);
    	PonCampo("tNombre",&tNombre,Tv_st);
    	PonCampo("cGrupos",&cGrupos,Tv_i4);
    	PonCampo("bIdioma",&bIdioma,Tv_i4);
    };
    
    DTCB_Opcion::DTCB_Opcion(char* nombre):CTcbRec(nombre)
    {
    	PonCampo("cGrupos",&cGrupos,Tv_i4|Cl_p);
    	PonCampo("cTipMen",&cTipMen,Tv_i4|Cl_p);
    	PonCampo("cAreas0",&cAreas0,Tv_i4|Cl_p);
    	PonCampo("cOpcion",&cOpcion,Tv_i4|Cl_p);
    	PonCampo("cOrdena",&cOrdena,Tv_i4);
    };
    
    DTCB_Rotulo::DTCB_Rotulo(char* nombre):CTcbRec(nombre)
    {
    	PonCampo("cCodigo",&cCodigo,Tv_i4|Cl_p);
    	PonCampo("tTitulo",&tTitulo,Tv_st);
    };
    DTCB_Areas0::DTCB_Areas0(char* nombre):CTcbRec(nombre)
    {
    	PonCampo("cAreas0",&cAreas0,Tv_i4|Cl_p);
    };
    
    BEGIN_MESSAGE_MAP(CTcbMen,CDialog)
    	ON_WM_PAINT()
    	ON_WM_CTLCOLOR()
    	ON_COMMAND_RANGE(TCB_AREAS0,TCB_AREAS7,OnAreas)
    	ON_COMMAND_RANGE(TCB_OPCION00,TCB_OPCION23,OnOpcion)
    //	ON_COMMAND(TCB_AGENDA,OnAgenda);
    	ON_COMMAND(TCB_FINALI,OnFinali)
    END_MESSAGE_MAP()
    
    CTcbMen::CTcbMen(CWnd* pParent,int menues,int tipMen):CDialog(),CModulo(),oColorA(RGB(248,250,175))
    {
    	bMenues=menues;
    	switch (bMenues)
    	{
    	case 0: kAreas0=6; kOpcion=18; break;
    	case 1: kAreas0=8; kOpcion=24; break;
    	case 2: kAreas0=0; kOpcion=24; break;
    	}
    	bTipMen=tipMen;
    	iOpcion=0;
    }
    void CTcbMen::DoDataExchange(CDataExchange* pDX)
    {
    	CDialog::DoDataExchange(pDX);
    	for (int n=0;n<kAreas0;n++) DDX_Control(pDX,TCB_AREAS0+n,wAreas0[n]);
    	for (int n=0;n<kOpcion;n++) DDX_Control(pDX,TCB_OPCION00+n,wOpcion[n]);
    }
    void CTcbMen::PostNcDestroy()
    {
    	CDialog::PostNcDestroy();
    	delete this;
    }
    BOOL CTcbMen::OnInitDialog()
    {
    	Clasifica(TCB_TITULO,wTitulo);
    	BOOL bSalida=CDialog::OnInitDialog();
    	LeeUsuari();
    	LlenaArea();
    	CheckRadioButton(TCB_AREAS0,TCB_AREAS5,TCB_AREAS0);
    	if (bMenues==2)
    		OnAreas2();
    	else
    		OnAreas1(TCB_AREAS0);
    	return bSalida;
    }
    HBRUSH CTcbMen::OnCtlColor(CDC* pDC,CWnd* pWnd,UINT nCtlColor)
    {
    	if (nCtlColor!=CTLCOLOR_STATIC)	return CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
    	pDC->SetTextColor(RGB(245,60,15));
    	pDC->SetBkColor(RGB(248,250,175));
    	return (HBRUSH)oColorA.GetSafeHandle();
    }
    void CTcbMen::LeeUsuari()
    {
    	unsigned long n=40;
    	char usuari[40];
    	GetUserName(usuari,&n);
    							//AfxMessageBox(usuari);
    	CRecord oRecord(gBasDat,&dTCB_Usuari);
    	dTCB_Usuari.tUsuari=usuari;
    	BddClaveP();
    	n=MAX_COMPUTERNAME_LENGTH + 1;
    	GetComputerName(tSistem,&n);
    	wTitulo.tSistem=tSistem;
    	wTitulo.tBasDat=gBasDat->zNomBdd;
    	bIdioma=dTCB_Usuari.bIdioma;
    	tUsuari=dTCB_Usuari.tUsuari;
    	CModulo::tUsuari=tUsuari;
    	CTcbPrn::bIdioma=dTCB_Usuari.bIdioma;
    	CTcbIco::bIdioma=dTCB_Usuari.bIdioma;
    }
    void CTcbMen::LlenaArea()
    {
    	char tSelect[1024];
    	wsprintf(tSelect,"SELECT DISTINCT cAreas0 FROM TCB_Opcion WHERE cGrupos=%d AND cTipMen=%d",dTCB_Usuari.cGrupos,4000+bTipMen);
    	CRecord oRecord(gBasDat,&dTCB_Areas0);
    	nAreas0=iAreas0=0;
    	nOpcion=0;
    	BUCLEd(LlenaArea1());
    }
    void CTcbMen::LlenaArea1()
    {
    	if (nAreas0<kAreas0)
    	{
    		CRecord oRecord(gBasDat,&dTCB_Rotulo);
    		dTCB_Rotulo.cCodigo=dTCB_Areas0.cAreas0;
    		BddClaveP();
    		aAreas0[nAreas0]=dTCB_Areas0.cAreas0;
    		wAreas0[nAreas0].PonIcono(dTCB_Areas0.cAreas0,dTCB_Rotulo.tTitulo,nAreas0+49);
    		Muestra(TCB_AREAS0+nAreas0++,SW_SHOW);
    	}
    }
    void CTcbMen::OnAreas(UINT nAreas0)
    {
    	if (bMenues!=2) wAreas0[iAreas0].Activa(false);
    	wOpcion[iOpcion].Activa(false);
    	OnAreas1(nAreas0);
    }
    #define AvanzaPro() // para que no haga nada
    void CTcbMen::OnAreas1(int nAreas0)
    {
    	if (iAreas0!=nAreas0-TCB_AREAS0) iOpcion=0;
    	iAreas0=nAreas0-TCB_AREAS0;
    	for (int n=0;n<nOpcion;n++) Muestra(TCB_OPCION00+n,SW_HIDE);
    	nOpcion=0;
    	CRecord oRecord(gBasDat);
    	oRecord.Tablas(&dTCB_Opcion,&dTCB_Rotulo);
    	char tTextos[1024];
    	wsprintf(tTextos,"A.cGrupos=%d AND A.cAreas0=%d AND A.cTipMen=%d AND A.cOpcion=B.cCodigo",dTCB_Usuari.cGrupos,aAreas0[iAreas0],4000+bTipMen);
    	BUCLEb(tTextos,"A.cOrdena",OnAreas());
    	if (bMenues!=2) wAreas0[iAreas0].Activa(true);
    	wOpcion[iOpcion].Activa(true);
    }
    void CTcbMen::OnAreas2()
    {
    	char tSelect[1024];
    	nOpcion=0;
    	for (int n=0;n<kOpcion;n++) Muestra(TCB_OPCION00+n,SW_HIDE);
    	wsprintf(tSelect,"SELECT DISTINCT cAreas0 FROM TCB_Opcion WHERE cGrupos=%d AND cTipMen=%d",dTCB_Usuari.cGrupos,4000+bTipMen);
    	CRecord oRecord(gBasDat,&dTCB_Areas0);
    	if (oRecord.Directo(tSelect))
    	{
    		nOpcion=0;
    		CRecord oRecord(gBasDat);
    		oRecord.Tablas(&dTCB_Opcion,&dTCB_Rotulo);
    		char tTextos[1024];
    		wsprintf(tTextos,"A.cGrupos=%d AND A.cAreas0=%d AND A.cTipMen=%d AND A.cOpcion=B.cCodigo",dTCB_Usuari.cGrupos,dTCB_Areas0.cAreas0,4000+bTipMen);
    		BUCLEb(tTextos,"A.cOrdena",OnAreas());
    	}
    }
    #undef AvanzaPro // para que no haga nada
    void CTcbMen::OnAreas()
    {
    	if (nOpcion<kOpcion)
    	{
    		aOpcion[nOpcion]=dTCB_Opcion.cOpcion;
    		wOpcion[nOpcion].PonIcono(dTCB_Opcion.cOpcion,dTCB_Rotulo.tTitulo,nOpcion+'A');
    		Muestra(TCB_OPCION00+nOpcion++,SW_SHOW);
    	}
    }
    void CTcbMen::Avanza(int n)
    {
    	UINT opcion=iOpcion;
    	wOpcion[iOpcion].Activa(false);
    	iOpcion+=n;
    	if (iOpcion<0||iOpcion>=nOpcion) iOpcion=opcion;
    	wOpcion[iOpcion].Activa(true);
    }
    void CTcbMen::OnOpcion(UINT opcion)
    {
    	if (opcion-TCB_OPCION00<nOpcion)
    	{
    		wOpcion[iOpcion].Activa(false);
    		iOpcion=opcion-TCB_OPCION00;
    		OnOK();
    	}
    }
    void CTcbMen::OnOK()
    {
    	wOpcion[iOpcion].Activa(true);
    	CRecord oRecord(gBasDat,&dTCB_Rotulo);
    	BddClave(aOpcion[iOpcion]);
    	GetParentFrame()->SendMessage(WM_COMMAND,aOpcion[iOpcion]);
    }
    BOOL CTcbMen::PreTranslateMessage(MSG* pMsg)
    {
        if (pMsg->message==WM_CHAR)
    	{
    		if (pMsg->wParam>='1'&&pMsg->wParam<='9') Pagina(pMsg->wParam-'1'); else
    		if (pMsg->wParam>='A'&&pMsg->wParam<='Z') OnOpcion(TCB_OPCION00+pMsg->wParam-'A'); else
    		if (pMsg->wParam>='a'&&pMsg->wParam<='z') OnOpcion(TCB_OPCION00+pMsg->wParam-'a');
    	} else
        if (pMsg->message==WM_KEYDOWN)
    	{
    		switch (pMsg->wParam)
    		{
    		case VK_LEFT: Avanza(-1); break;
    		case VK_RIGHT: Avanza(1); break;
    		case VK_UP: Avanza(-3); break;
    		case VK_DOWN: Avanza(3); break;
    		case VK_PRIOR: Pagina(iAreas0-1); break;
    		case VK_NEXT: Pagina(iAreas0+1); break;
    		case VK_F12: return FALSE;
    		}
        }
    	return CDialog::PreTranslateMessage(pMsg);
    }
    void CTcbMen::Pagina(int n)
    {
    	if (n<nAreas0)
    	{
    		int areas=iAreas0;
    		if (bMenues!=2) wAreas0[iAreas0].Activa(false);
    		wOpcion[iOpcion].Activa(false);
    		areas=n;
    		if (areas>=0&&areas<nAreas0) OnAreas1(areas+TCB_AREAS0);
    		if (bMenues!=2) wAreas0[iAreas0].Activa(true);
    		wOpcion[iOpcion].Activa(true);
    	}
    }
    /*
    void CTcbMen::Pagina(int n)
    {
    	int areas=iAreas0;
    	if (bMenues!=2)  wAreas0[iAreas0].Activa(false);
    	wOpcion[iOpcion].Activa(false);
    	areas+=n;
    	if (areas>=0&&areas<nAreas0) OnAreas1(areas+TCB_AREAS0);
    	if (bMenues!=2)  wAreas0[iAreas0].Activa(true);
    	wOpcion[iOpcion].Activa(true);
    }*/
    /*
    void CTcbMen::Pinta1(int h)
    {
    	CClientDC dc(this);
    	CRect oRectan;
    	Muestra(TCB_OPCION00+iOpcion,SW_HIDE);
    	CWnd* oAreas=GetDlgItem(iOpcion+TCB_OPCION00);
    	oAreas->GetWindowRect(&oRectan);
    	ScreenToClient(&oRectan);
    	oRectan.top-=6;
    	oRectan.bottom+=6;
    	oRectan.left-=6;
    	oRectan.right+=6;
    	CBrush oPincel(h?RGB(235,115,65):RGB(160,160,255));
    	CPen oPlumas(PS_NULL,0,RGB(136,105,228));
    	dc.SelectObject(oPincel);
    	dc.SelectObject(oPlumas);
    	dc.Rectangle(oRectan);
    	Muestra(TCB_OPCION00+iOpcion,SW_SHOW);
    }
    void CTcbMen::Pinta2(int h)
    {
    	CClientDC dc(this);
    	CRect oRectan;
    	Muestra(TCB_AREAS0+iAreas0,SW_HIDE);
    	CWnd* oAreas=GetDlgItem(iAreas0+TCB_AREAS0);
    	oAreas->GetWindowRect(&oRectan);
    	ScreenToClient(&oRectan);
    	oRectan.top-=10;
    	oRectan.bottom+=10;
    	oRectan.left-=10;
    	oRectan.right+=10;
    	CBrush oPincel(h?RGB(123,65,167):RGB(136,105,228));
    	CPen oPlumas(PS_NULL,0,RGB(136,105,228));
    	dc.SelectObject(oPincel);
    	dc.SelectObject(oPlumas);
    	dc.Rectangle(oRectan);
    	Muestra(TCB_AREAS0+iAreas0,SW_SHOW);
    }
    */
    void CTcbMen::OnPaint()
    {
    	CPaintDC dc(this);
    	CDC Compat;
    	CBitmap Textura;
    	BITMAP DesTex;
    	Textura.LoadBitmap(TCB_MENUES);
    	Textura.GetBitmap(&DesTex);
    	Compat.CreateCompatibleDC(&dc);
    	Compat.SelectObject(&Textura);
    	dc.BitBlt(0,0,DesTex.bmWidth,DesTex.bmHeight,&Compat,0,0,SRCCOPY);
    	// Recuadro de Areas
    	if (bMenues!=2)
    	{
     	CRect oRectan;
    	CWnd* oAreas=GetDlgItem(TCB_CUADRO);
    	if (oAreas)
    	{
    		oAreas->GetWindowRect(&oRectan);
    		ScreenToClient(&oRectan);
    		oRectan.top+=6;
    		CBrush oPincel(RGB(212,208,200));
    		CPen oPlumas(PS_NULL,0,RGB(212,208,200));
    		dc.SelectObject(oPincel);
    		dc.SelectObject(oPlumas);
    		dc.Rectangle(oRectan);
    	}
    /*
    	oAreas=GetDlgItem(iAreas0+TCB_AREAS0);
    	oAreas->GetWindowRect(&oRectan);
    	ScreenToClient(&oRectan);
    	oRectan.top-=10;
    	oRectan.bottom+=10;
    	oRectan.left-=10;
    	oRectan.right+=10;
    	CBrush oPincel(RGB(123,65,167));
    	CPen oPlumas(PS_NULL,0,RGB(136,105,228));
    	dc.SelectObject(oPincel);
    	dc.SelectObject(oPlumas);
    	dc.Rectangle(oRectan);
    	oAreas=GetDlgItem(iOpcion+TCB_OPCION00);
    	oAreas->GetWindowRect(&oRectan);
    	ScreenToClient(&oRectan);
    	oRectan.top-=6;
    	oRectan.bottom+=6;
    	oRectan.left-=6;
    	oRectan.right+=6;
    	{
    	CBrush oPincel(RGB(235,115,65));
    	CPen oPlumas(PS_NULL,0,RGB(136,105,228));
    	dc.SelectObject(oPincel);
    	dc.SelectObject(oPlumas);
    	dc.Rectangle(oRectan);
    	}
    */
    	}
    }
    void CTcbMen::OnFinali()
    {
    	GetParentFrame()->SendMessage(WM_COMMAND,TCB_FINALI);
    }
    BEGIN_MESSAGE_MAP(CTcbMen2,CStatic)
    	ON_WM_PAINT()
    END_MESSAGE_MAP()
    void CTcbMen2::OnPaint()
    {
    	CPaintDC dc(this);
    	CRect oRectan;
    	GetClientRect(oRectan);
    	CBrush oPincel(RGB(248,250,175));
    	dc.FillRect(&oRectan,&oPincel);
    	oRectan.left+=2;
    	oRectan.right-=2;
    	CRect r1(oRectan),r2(oRectan);
    	r1.bottom/=2;
    	r2.top=r1.bottom;
    	CFont oLetra1;
    	CFont oLetra2;
    	oLetra1.CreateFont(-14,0,0,0,FW_NORMAL,0,0,0,0,0,0,0,0,"Arial");
    	oLetra2.CreateFont(-20,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"Arial");
    	dc.SetTextColor(RGB(0,0,0));
    	dc.SetBkMode(TRANSPARENT);
    	dc.SelectObject(&oLetra1);
    	CTime hoy=CTime::GetCurrentTime();
    //	CString s=hoy.Format("%A, %d %b %Y");
    
    	char* txDia[]={"Diumenge|Domingo","Dilluns|Lunes","Dimarts|Martes","Dimecres|Miércoles","Dijous|Jueves","Divendres|Viernes","Dissabte|Sábado"};
    	char* txMes[]={"Gener|Enero","Febrer|Febrero","Març|Marzo","Abril","Maig|Mayo","Juny|Junio","Juliol|Julio","Agost|Agosto","Setembre|Septiembre","Octubre","Novembre|Noviembre","Desembre|Diciembre"};
    	CString s;
    	s.Format("%s, %d %s %d",RotuloIdioma(txDia[hoy.GetDayOfWeek()-1]),hoy.GetDay(),RotuloIdioma(txMes[hoy.GetMonth()-1]),hoy.GetYear());
    
    	dc.DrawText(dTCB_Usuari.tNombre,r1,DT_RIGHT|DT_VCENTER|DT_SINGLELINE);
    	dc.DrawText(tBasDat,r1,DT_LEFT|DT_VCENTER|DT_SINGLELINE);
    	dc.DrawText(s,r2,DT_LEFT|DT_VCENTER|DT_SINGLELINE);
    	dc.DrawText(tSistem,r2,DT_RIGHT|DT_VCENTER|DT_SINGLELINE);
    	dc.SelectObject(&oLetra2);
    	dc.DrawText("Ares",oRectan,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
    }
    /*****************************************************************************************/
    /*						               CTcbAcc                                           */
    /*					                                                                     */
    /*		                     Ventana de Acción (botones superiores)                      */
    /*		                                                                                 */
    /*****************************************************************************************/
    
    BEGIN_MESSAGE_MAP(CTcbAcc,CDialog)
    	ON_COMMAND_RANGE(TCB_BOTON0_BUT,TCB_BOTONC_BUT,OnBotons)
    	ON_WM_PAINT()
    	ON_WM_SETFOCUS()
    END_MESSAGE_MAP()
    
    CTcbAcc::CTcbAcc(CWnd* pParent):CDialog(TCB_ACCION,pParent),dOpcion("TCB_Rotulo")
    {
    	nOpcion1=nOpcion2=nOpcion2=0;
    	iOpcion=kOpcion=0;
    	nBotons=0;
    	mBotons=12;
    	kBotons=13;
    	nSelecc=-1;
    	for (int n=0;n<14;n++) bOpcion[n]=0;
    }
    void CTcbAcc::DoDataExchange(CDataExchange* pDX)
    {
    	CDialog::DoDataExchange(pDX);
    	DDX_Control(pDX,TCB_BOTON0_BUT,wBoton[0]);
    	DDX_Control(pDX,TCB_BOTON1_BUT,wBoton[1]);
    	DDX_Control(pDX,TCB_BOTON2_BUT,wBoton[2]);
    	DDX_Control(pDX,TCB_BOTON3_BUT,wBoton[3]);
    	DDX_Control(pDX,TCB_BOTON4_BUT,wBoton[4]);
    	DDX_Control(pDX,TCB_BOTON5_BUT,wBoton[5]);
    	DDX_Control(pDX,TCB_BOTON6_BUT,wBoton[6]);
    	DDX_Control(pDX,TCB_BOTON7_BUT,wBoton[7]);
    	DDX_Control(pDX,TCB_BOTON8_BUT,wBoton[8]);
    	DDX_Control(pDX,TCB_BOTON9_BUT,wBoton[9]);
    	DDX_Control(pDX,TCB_BOTONA_BUT,wBoton[10]);
    	DDX_Control(pDX,TCB_BOTONB_BUT,wBoton[11]);
    	DDX_Control(pDX,TCB_BOTONC_BUT,wBoton[12]);
    }
    void CTcbAcc::PostNcDestroy()
    {
    	CDialog::PostNcDestroy();
    	delete this;
    }
    BOOL CTcbAcc::OnInitDialog()
    {
    	return CDialog::OnInitDialog();
    }
    void CTcbAcc::OnSetFocus(CWnd* wnd)
    {
    	if (MARCOS->wOpcion) MARCOS->wOpcion->SetFocus();
    }
    void CTcbAcc::OnBotons(UINT nIDD)
    {
    	if ((int)nIDD-TCB_BOTON0_BUT>kBotons&&bOculta) return;
    	if ((int)nIDD-TCB_BOTON0_BUT>kBotons&&bOpcion[nIDD-TCB_BOTON0_BUT]==0) return;
    	if ((int)nIDD-TCB_BOTON0_BUT>kBotons&&!MARCOS->SalOpcion(aBotons[nIDD-TCB_BOTON0_BUT])) return;
    	GetParentFrame()->SendMessage(WM_COMMAND,aBotons[nIDD-TCB_BOTON0_BUT]);
    }
    void CTcbAcc::OnPaint()
    {
    	CPaintDC dc(this);
    	CFont oLetras;
    	CDC Compat;
    	CBitmap Textura;
    	BITMAP DesTex;
    	Textura.LoadBitmap(TCB_ACCION);
    	Textura.GetBitmap(&DesTex);
    	Compat.CreateCompatibleDC(&dc);
    	Compat.SelectObject(&Textura);
    	dc.BitBlt(0,0,DesTex.bmWidth,DesTex.bmHeight,&Compat,0,0,SRCCOPY);
    }
    void CTcbAcc::PonBoton(UINT nIDD0,UINT nIDD1,UINT nIDD2,UINT nIDD3,UINT nIDD4,UINT nIDD5,UINT nIDD6,UINT nIDD7,UINT nIDD8,UINT nIDD9,UINT nIDDA,UINT nIDDB,UINT nIDDC)
    {
    	MARCOS->nReturn=0;
    	MARCOS->nEscape=0;
    	for (int n=0;n<mBotons;n++) Muestra(TCB_BOTON0_BUT+n,SW_HIDE);
    	nBotons=0;
    	mBotons=0;
    	PonBoton_(nIDD0);
    	PonBoton_(nIDD1);
    	PonBoton_(nIDD2);
    	PonBoton_(nIDD3);
    	PonBoton_(nIDD4);
    	PonBoton_(nIDD5);
    	PonBoton_(nIDD6);
    	PonBoton_(nIDD7);
    	PonBoton_(nIDD8);
    	PonBoton_(nIDD9);
    	PonBoton_(nIDDA);
    	PonBoton_(nIDDB);
    	PonBoton_(nIDDC);
    }
    void CTcbAcc::PonBoton_(UINT nIDD)
    {
    	TCHAR* ch=" RE";
    	if (nIDD>10000) MARCOS->PonBoton2(nIDD);
    	if (nIDD)
    	{
    		aBotons[nBotons]=nIDD%10000;
    		wBoton[nBotons].PonIcono(nIDD%10000,0,ch[nIDD/10000]);
    		mBotons=nBotons+1;
    		Muestra(TCB_BOTON0_BUT+nBotons,SW_SHOW);
    	}
    	nBotons++;
    }
    void CTcbAcc::PonOpcion(int opcion,UINT nIDD0,UINT nIDD1,UINT nIDD2,UINT nIDD3,UINT nIDD4,UINT nIDD5,UINT nIDD6,UINT nIDD7,UINT nIDD8,UINT nIDD9,UINT nIDDA,UINT nIDDB,UINT nIDDC)
    {
    	cOpcion=opcion;
    	for (int n=12;n>kBotons;n--) Muestra(TCB_BOTON0_BUT+n,SW_HIDE);
    	kBotons=12;
    // 	PonOpcion_(nIDD0);
    	PonOpcion_(nIDD1);
    	PonOpcion_(nIDD2);
    	PonOpcion_(nIDD3);
    	PonOpcion_(nIDD4);
    	PonOpcion_(nIDD5);
    	PonOpcion_(nIDD6);
    	PonOpcion_(nIDD7);
    	PonOpcion_(nIDD8);
    	PonOpcion_(nIDD9);
    	PonOpcion_(nIDDA);
    	PonOpcion_(nIDDB);
    	PonOpcion_(nIDDC);
    	bOculta=false;
    	Selecc(0);
    }
    void CTcbAcc::ActivaOpcion(int opcion,int estado)
    {
    	bOpcion[12-opcion]=estado;
    	wBoton[12-opcion].Activa(estado!=0);
    	if (cOpcion==2) Muestra(TCB_BOTON0_BUT+12-opcion,SW_SHOW);
    }
    void CTcbAcc::PonOpcion_(UINT nIDD)
    {
    	if (nIDD)
    	{
    		aBotons[kBotons]=nIDD;
    		bOpcion[kBotons]=cOpcion==0;
    		wBoton[kBotons].PonIcono(nIDD,bOpcion[kBotons],TCHAR(13-kBotons+'0'));
    		if (cOpcion<2) Muestra(TCB_BOTON0_BUT+kBotons,SW_SHOW);
    		kBotons--;
    	}
    }
    void CTcbAcc::InsertaOpcion(UINT nIDD,int po)
    {
    	if (nIDD)
    	{
    		if (po>12-kBotons) po=12-kBotons;
    		for (int n=kBotons;n<12-po;n++)
    		{
    			aBotons[n]=aBotons[n+1];
    			bOpcion[n]=bOpcion[n+1];
    			wBoton[n].PonIcono(aBotons[n+1],bOpcion[n+1],TCHAR(13-n+'0'));
    		}
    		aBotons[12-po]=nIDD;
    		bOpcion[12-po]=cOpcion==0;
    		wBoton[12-po].PonIcono(nIDD,bOpcion[12-po],TCHAR(13-12-po+'0'));
    		if (cOpcion<2) Muestra(TCB_BOTON0_BUT+12-po,SW_SHOW);
    		kBotons--;
    	}
    }
    void CTcbAcc::Selecc(int selecc)
    {
    	if (nSelecc>=0) wBoton[12-nSelecc].Selecc(false);
    	if (selecc>=0) wBoton[12-selecc].Selecc(true);
    	nSelecc=selecc;
    }
    void CTcbAcc::OcultaOpcion(UINT idc,bool estado)
    {
    	for (int n=12;n>kBotons;n--) Muestra(TCB_BOTON0_BUT+n,estado?SW_HIDE:SW_SHOW);
    }
    void CTcbAcc::OcultaOpcion(bool estado)
    {
    	bOculta=estado;
    	for (int n=12;n>kBotons;n--) Muestra(TCB_BOTON0_BUT+n,estado?SW_HIDE:SW_SHOW);
    }
    /*****************************************************************************************/
    /*						               CTcbEst                                           */
    /*					                                                                     */
    /*		               Ventana de Estado (ayuda y control progreso)                      */
    /*		                                                                                 */
    /*****************************************************************************************/
    
    BEGIN_MESSAGE_MAP(CTcbEst,CDialog)
    	ON_WM_PAINT()
    	ON_WM_CTLCOLOR()
    	ON_COMMAND(TCB_IMPRES_BUT,SelImp)
    	ON_BN_CLICKED(TCB_OPCION01,OnImp)
    	ON_BN_CLICKED(TCB_OPCION02,OnPdf)
    //	ON_BN_CLICKED(TCB_OPCION03,OnPan)
    	ON_BN_CLICKED(TCB_OPCION04,OnFic)
    END_MESSAGE_MAP()
    
    CTcbEst::CTcbEst():CDialog(),oColorA(RGB(244,248,137))
    {
    	Letras();
    }
    void CTcbEst::DoDataExchange(CDataExchange* pDX)
    {
    	int valor=1;
    	DDX_Check(pDX,TCB_OPCION01,valor);
    	CDialog::DoDataExchange(pDX);
    }
    void CTcbEst::PostNcDestroy()
    {
    	CDialog::PostNcDestroy();
    	delete this;
    }
    BOOL CTcbEst::OnInitDialog()
    {
    	bErrors=false;
    	bOcupad=false;
    	GetDlgItem(TCB_REDUCE_STA)->SetFont(&oLetraA);
    	PonCheck(TCB_OPCION01,TRUE);
    	return CDialog::OnInitDialog();
    }
    int CTcbEst::Pinta(CDC& dc,CRect re)
    {
    	CRect r(re);
    	r.left+=4;
    	CString lineas;
    	CString salida;
    	TCHAR unidad[1024];
    	LPTSTR avanza=unidad;
    	LPTSTR tocken=tAyudas.GetBuffer();
    	CSize sz;
    	bool primer=false;
    	int numero=0;
    	while (*tocken)
    	{
    		if (*tocken==32)
    		{
    			*avanza++=0;
    			lineas=salida+' '+unidad;
    			sz=dc.GetTextExtent(lineas);
    			if (sz.cx>r.Width())
    			{
    				dc.DrawText(salida,r,DT_VCENTER|DT_LEFT);
    				r.OffsetRect(0,sz.cy-2);
    				salida.Empty();
    				primer=false;
    				numero++;
    			}
    			if (primer) salida+=' ';
    			salida+=unidad;
    			avanza=unidad;
    			while (*tocken==32) tocken++;
    		}
    		primer=true;
    		if (*tocken) *avanza++=*tocken++;
    	}
    	if (primer)
    	{
    		*avanza++=0;
    		lineas=salida+' '+unidad;
    		sz=dc.GetTextExtent(lineas);
    		if (sz.cx>r.Width())
    		{
    			sz=dc.GetTextExtent(salida);
    			CRect s(r);
    			dc.DrawText(salida,r,DT_VCENTER|DT_LEFT);
    			r.OffsetRect(0,sz.cy-2);
    			salida.Empty();
    			numero++;
    		}
    		else
    			salida+=' ';
    		salida+=unidad; 
    		dc.DrawText(salida,r,DT_VCENTER|DT_LEFT);
    		numero++;
    	}
    	return numero;
    }
    void CTcbEst::OnPaint()
    {
    	CPaintDC dc(this);
    	CFont oLetra1;
    	CFont oLetra2;
    	CFont oLetra3;
    	oLetra1.CreateFont(-14,0,0,0,FW_NORMAL,0,0,0,0,0,0,0,0,"Arial");
    	oLetra2.CreateFont(-16,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"Arial");
    	oLetra3.CreateFont(-12,0,0,0,FW_NORMAL,0,0,0,0,0,0,0,0,"Arial");
    	CRect oRectan;
    	GetClientRect(oRectan);
    	if (!tAyudas.IsEmpty())
    	{
    		HICON oIcono=AfxGetApp()->LoadIcon(bOcupad?4:(bErrors?3:2));
    		dc.DrawIcon(2,2,oIcono);
    		oRectan.left+=40;
    		oRectan.right-=150;
    		CBrush oPincel(bOcupad?RGB(250,200,130):(bErrors?RGB(250,100,85):RGB(245,250,140)));
    		dc.FillRect(&oRectan,&oPincel);
    		dc.Draw3dRect(oRectan,RGB(0,0,0),RGB(255,255,255));
    		dc.SelectObject(&oLetra2);
    		CSize sz=dc.GetTextExtent(tAyudas);
    		dc.SetTextColor(bErrors?RGB(30,20,240):RGB(245,60,15));
    		dc.SetBkMode(TRANSPARENT);
    		oRectan.left+=1;
    		if (sz.cx<oRectan.Width())
    		{
    			dc.DrawText(tAyudas,oRectan,DT_VCENTER|DT_LEFT);
    		}
    		else
    		{
    			dc.SelectObject(&oLetra1);
    			CSize sz=dc.GetTextExtent(tAyudas);
    			if (sz.cx>oRectan.Width())
    			{
    				CRect r(oRectan);
    				r.bottom=r.top+sz.cy;
    				if (Pinta(dc,r)>2)
    				{
    					CRect r(oRectan);
    					r.bottom=r.top+sz.cy;
    					dc.SelectObject(&oLetra3);
    					dc.FillRect(&oRectan,&oPincel);
    					dc.Draw3dRect(oRectan,RGB(0,0,0),RGB(255,255,255));
    					Pinta(dc,r);
    				}
    			}
    			else
    				dc.DrawText(tAyudas,oRectan,DT_VCENTER|DT_LEFT);
    		}
    	}
    }
    HBRUSH CTcbEst::OnCtlColor(CDC* pDC,CWnd* pWnd,UINT nCtlColor)
    {
    	if (nCtlColor!=CTLCOLOR_STATIC)	return CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
    	pDC->SetTextColor(RGB(245,60,15));
    	pDC->SetBkColor(RGB(244,248,137));
    	return (HBRUSH) oColorA.GetSafeHandle();
    }
    void CTcbEst::Letras()
    {
    	oLetraA.CreateFont(14,0,0,0,FW_NORMAL,0,0,0,0,0,0,0,0,"Arial");
    	oLetraB.CreateFont(24,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"Arial");
    }
    void CTcbEst::IniPro(long maximo)
    {
    	GetDlgItem(TCB_REDUCE_STA)->ShowWindow(SW_SHOW);
    	GetDlgItem(TCB_ESTADO_PRO)->ShowWindow(SW_SHOW);
    	((CProgressCtrl*)GetDlgItem(TCB_ESTADO_PRO))->SetRange32(0,maximo);
    	nMaximo=maximo;
    }
    void CTcbEst::AvanzaPro(long numero)
    {
    	((CProgressCtrl*)GetDlgItem(TCB_ESTADO_PRO))->SetPos(numero);
    	char salida[200];
    	if (nMaximo)
    		wsprintf(salida,"Procesados %d de %d",numero,nMaximo);
    	else
    		strcpy(salida,RotuloIdioma("En Procès...|En Proceso..."));
    	PonTexto(TCB_REDUCE_STA,salida);
    }
    void CTcbEst::FinPro()
    {
    	GetDlgItem(TCB_REDUCE_STA)->ShowWindow(SW_HIDE);
    	GetDlgItem(TCB_ESTADO_PRO)->ShowWindow(SW_HIDE);
    }
    void CTcbEst::TcbReloj(bool ocupad,LPCTSTR textos)
    {
    	bOcupad=ocupad;
    	if (bOcupad)
    		tAyudas=RotuloIdioma(textos?textos:"Demanant dades al servidor...|Pidiendo datos al servidor...");
    	else if (bAyudas)
    		tAyudas.Empty();
    	bAyudas=true;
    	Invalidate();
    }
    void CTcbEst::PonAyuda(UINT nIDC)
    {
    	CString ayudas;
    	ayudas.LoadString(nIDC);
    	PonAyuda(ayudas);
    }
    void CTcbEst::PonAyuda(LPCTSTR ayudas,bool errors)
    {
    	bErrors=errors;
    	bAyudas=false;
    	tAyudas=RotuloIdioma(ayudas);
    	if (!tAyudas.IsEmpty())
    	{
    		if (tAyudas[0]=='\"') tAyudas=tAyudas.Right(tAyudas.GetLength()-1);
    		if (tAyudas[tAyudas.GetLength()-1]=='\"') tAyudas=tAyudas.Left(tAyudas.GetLength()-1);
    	}
    	Invalidate();
    }
    void CTcbEst::QuitaAyuda()
    {
    	bErrors=false;
    	tAyudas.Empty();
    	Invalidate();
    }
    void CTcbEst::IniImp()
    {
    	PonImp();
    }
    void CTcbEst::SelImp()
    {
    	CTcbPrn::PonImp();
    	PonImp();
    }
    void CTcbEst::PonImp()
    {
    	PonTexto(TCB_IMPRES_BUT,CTcbPrn::tDevice);
    	GetDlgItem(TCB_IMPRES_BUT)->ShowWindow(SW_SHOW);
    	GetDlgItem(TCB_OPCION01)->ShowWindow(SW_SHOW);
    	GetDlgItem(TCB_OPCION02)->ShowWindow(SW_SHOW);
    //	GetDlgItem(TCB_OPCION03)->ShowWindow(SW_SHOW);
    	GetDlgItem(TCB_OPCION04)->ShowWindow(SW_SHOW);
    }
    void CTcbEst::FinImp()
    {
    	GetDlgItem(TCB_IMPRES_BUT)->ShowWindow(SW_HIDE);
    	GetDlgItem(TCB_OPCION01)->ShowWindow(SW_HIDE);
    	GetDlgItem(TCB_OPCION02)->ShowWindow(SW_HIDE);
    //	GetDlgItem(TCB_OPCION03)->ShowWindow(SW_HIDE);
    	GetDlgItem(TCB_OPCION04)->ShowWindow(SW_HIDE);
    }
    void CTcbEst::OnImp()
    {
    	CTcbPrn::bTcbInf&=~In_imp;
    	if (LeeCheck(TCB_OPCION01))	CTcbPrn::bTcbInf|=In_imp;
    }
    void CTcbEst::OnPdf()
    {
    	CTcbPrn::bTcbInf&=~In_pdf;
    	if (LeeCheck(TCB_OPCION02)) CTcbPrn::bTcbInf|=In_pdf;
    }
    void CTcbEst::OnPan()
    {
    	CTcbPrn::bTcbInf&=~In_pan;
    	if (LeeCheck(TCB_OPCION03)) CTcbPrn::bTcbInf|=In_pan;
    }
    void CTcbEst::OnFic()
    {
    	CTcbPrn::bTcbInf&=~In_fic;
    	if (LeeCheck(TCB_OPCION04)) CTcbPrn::bTcbInf|=In_fic;
    }
    CTcbReloj::CTcbReloj():CWaitCursor()
    {
    	CWinApp* app=AfxGetApp();
    	CTcbMar* marcos=(CTcbMar*)app->m_pMainWnd;
    	CTcbPan* opcion=marcos->wOpcion;
    	opcion->TcbReloj(true);
    }
    CTcbReloj::CTcbReloj(LPCTSTR textos):CWaitCursor()
    {
    	CWinApp* app=AfxGetApp();
    	CTcbMar* marcos=(CTcbMar*)app->m_pMainWnd;
    	CTcbPan* opcion=marcos->wOpcion;
    	opcion->TcbReloj(true,textos);
    }
    CTcbReloj::~CTcbReloj()
    {
    	CWinApp* app=AfxGetApp();
    	CTcbMar* marcos=(CTcbMar*)app->m_pMainWnd;
    	CTcbPan* opcion=marcos->wOpcion;
    	opcion->TcbReloj(false);
    }
    long CTcbIco::bIdioma=0;
    CTcbBdd* CModulo::gBasDat=NULL;
    CString CModulo::tUsuari;
    long CModulo::bIdioma;
    

    Thursday, April 25, 2019 1:03 PM
  • Objects CAresB and CAres find them in Ares001.cpp and Ares 002.cpp (CAres gAres;)
    Thank you very much for your help.
    Murat Altun
    Thursday, April 25, 2019 1:17 PM
  • ares1\TcbLib-Dll\Cpp\TcbApl.cpp(63):BOOL CTcbBat::InitInstance(LPCTSTR nombre,bool tamano)
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(84): ((CTcbBat0*)m_pMainWnd)->CreaMarco(nombre,oParame.opcion);
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(87):int CTcbBat::ExitInstance()
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(111):BEGIN_MESSAGE_MAP(CTcbBat2,CStatic)
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(114):void CTcbBat2::OnPaint()
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(145):BEGIN_MESSAGE_MAP(CTcbBat0,CFrameWnd)
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(148):void CTcbBat0::CreaMarco(LPCTSTR nombre,long opcion)
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(158):void CTcbBat0::OnTimer(UINT nTimer)
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(174):void CTcbBat0::Procesa(UINT opcion)
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(198):void CTcbBat0::Planifica()
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(221):void CTcbBat0::OnSalida()
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(225):void CTcbBat0::OnClose()
    Thursday, April 25, 2019 1:29 PM
  • ares1\TcbLib-Dll\Cpp\TcbApl.cpp(30):BOOL CTcbApp::InitInstance(LPCTSTR nombre,bool tamano)
    ares1\TcbLib-Dll\Cpp\TcbApl.cpp(58):int CTcbApp::ExitInstance()
    Thursday, April 25, 2019 1:32 PM
  • Hello,

    I notified that Both CAres and CAresB have the gAres object. Have you tried to remove one?
    like this:

    // CAresB gAres; // remove the CAresB project 

    or 

    // CAres gAres;  // remove the CAresB project

    Best Wishes,

    Jack Zhang


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Altun Murat Thursday, May 2, 2019 12:50 PM
    • Unmarked as answer by Altun Murat Thursday, May 2, 2019 12:50 PM
    • Marked as answer by Altun Murat Tuesday, May 7, 2019 7:37 AM
    • Unmarked as answer by Altun Murat Wednesday, July 24, 2019 12:04 PM
    Friday, April 26, 2019 9:06 AM
    Moderator
  • Hi

    I tried to eliminate one and the other one and the both of them. I have the same errors

    Breakpoints

    TcbCob.cpp

    CFicCob::CFicCob()

    Buffer=NULL; -> The breakpoint will not currently be hit. No symbols have been loaded for this document. Location: TcbCob.cpp, line 12('CFicCob()')

    TcbInf.cpp

    void CTcbInf::PonDirPdf(CString camino) {tDirPdf=camino;} -> The breakpoint will not currently be hit. No symbols have been loaded for this document. Location: TcbInf.cpp, line 196

    TcbWrd.cpp

    V_TRUE ((short)TRUE), -> The breakpoint will not currently be hit. No symbols have been loaded for this document. Location: TcbWrd.cpp, line22

    winmain.cpp

    // Perform specific initializations
    if (!pThread->InitInstance())
    {
    if (pThread->m_pMainWnd != NULL)
    {
    TRACE(traceAppMsg, 0, "Warning: Destroying non-NULL m_pMainWnd\n");
    pThread->m_pMainWnd->DestroyWindow();
    }
    nReturnCode = pThread->ExitInstance();
    goto InitFailure;
    }
    nReturnCode = pThread->Run();

    InitFailure:

    -> The breakpoint will not currently be hit. A copy of winmain.cpp was found in mfc140d.dll, but the current source code is different from the version built into mfc140d.dll.

    To allow this breakpoint to be hit: right-click on the breakpoint, choose either 'Conditions...' or 'Settings..'. Then choose 'Location', 'Allow the source code to be different from the original.'

    To allow this for all breakpoints, disable the option 'Require source files to exactly match the original version' under Tools, Options, Debugging, General.

    Location: winmain.cpp, line 55 ('AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,_In_LPTSTR lpCmdLine, int nCmdShow)') 

    Tuesday, April 30, 2019 9:49 AM
  • Output

    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\vcruntime140d.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ucrtbased.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp140d.dll'
    Debug Assertion Failed!

    Program: C:\WINDOWS\SYSTEM32\mfc140d.dll
    File: d:\agent\_work\3\s\src\vctools\vc7libs\ship\atlmfc\src\mfc\appcore.cpp
    Line: 196

    For information on how your program can cause an assertion
    failure, see the Visual C++ documentation on asserts.

    (Press Retry to debug the application)
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\WinTypes.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\WinTypes.dll'

    Tuesday, April 30, 2019 10:12 AM
  • Hello, 

    Now I have this error:

    Ares2017.exe - Entry Point Not Found 

    The procedure entry point 

    ?GetMessageMap@CTcbBat0@@MBEPBUAFX_MSGMAP@@XZ could not be located in the dynamic link library C:\Users\altun.murat\Desktop\ares1-version19042019\ares1\ARESproject-vs2017\Debug\Ares2017.exe. 

    ------------------------------------------------------------------------------------------------------------------

    The procedure entry point 

    ?GetMessageMap@CTcbBat0@@MBEPBUAFX_MSGMAP@@XZ could not be located in the dynamic link library C:\Users\altun.murat\Desktop\ares1-version19042019\ares1\ARESproject-vs2017\Debug\TcbLib.dll. 

    Thursday, May 2, 2019 12:48 PM
  • Hello,

    >>The procedure entry point 
    ?GetMessageMap@CTcbBat0@@MBEPBUAFX_MSGMAP@@XZ could not be located in the dynamic link library C:\Users\altun.murat\Desktop\ares1-version19042019\ares1\ARESproject-vs2017\Debug\TcbLib.dll. 

    Sorry for my late reply, I have a holiday from May 1st to May 5th. Seems that something wrong with the TcbLib.dll, have you tried rebuilding the TcbLib.dll in VS2017. More details please refer to this link.

    Best Wishes,

    Jack


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Altun Murat Monday, May 6, 2019 5:23 AM
    • Unmarked as answer by Altun Murat Tuesday, May 7, 2019 6:53 AM
    Monday, May 6, 2019 3:43 AM
    Moderator
  • Hello, I've made changes to the TcbLib.cpp file until we broke it, so I was making the last mistake, I went back to the initial error.

    'Ares2017.exe' (Win32): Unloaded 'C:\Users\altun.murat\Desktop\ares1-version19042019\ares1\ARESproject-vs2017\Debug\TBarCode6.ocx'
    Debug Assertion Failed!

    Program: ...s1-version19042019\ares1\ARESproject-vs2017\Debug\mfc140d.dll
    File: d:\agent\_work\3\s\src\vctools\vc7libs\ship\atlmfc\src\mfc\appcore.cpp
    Line: 196

    For information on how your program can cause an assertion
    failure, see the Visual C++ documentation on asserts.

    (Press Retry to debug the application)
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\WinTypes.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\WinTypes.dll'
    The thread 0x2a5c has exited with code 0 (0x0).
    The thread 0x2a30 has exited with code 0 (0x0).

    Monday, May 6, 2019 5:33 AM
  • This error may be from TBarCode6.ocx, to which I have the executable and I installed it, but not manages to load it. This program is for barcode and runs on a Windows XP x86. The error that gives it to me is this:
    Binary was not built with debug information.
    Monday, May 6, 2019 5:41 AM
  • Hello,

    >>Binary was not built with debug information.

    It's not an installation issue, the problem is, as the error message suggests, that you have not built your project with debug information.

    Try this:
    1) Goto Project->Properties
    2) Make sure "Configuration" at the top is "Debug"
    3) On the left, select "C/C++", then "General"
    4) On the right, change "Debug information format" to "Program Database for edit and continue (/ZI)"
    5) On the left, Select "Optimization"
    6) On the right, Change "Optimization" to "Disabled (/Od)"
    7) On the left, select "Code Generation"
    8) On the right, change "Runtime library" to "Multi-Threaded Debug (/MTd)"
    9) On the left, expand "Linker" and select "Debugging"
    10) On the right, change "Generate Debug info" to "
    Generate Debug Information (/DEBUG)"
    11) Rebuild your project.

    More details here.

    Best Wishes,

    Jack


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Altun Murat Tuesday, May 7, 2019 7:39 AM
    Monday, May 6, 2019 5:58 AM
    Moderator
  • Hello,

    I've just made the changes you've told me.

    If I try to Properties Configuration - Debug I have fewer error then Active(Debug).

    Should I change it Platform now I have Active(Win32)

    TBarCode6.ocx  

    Symbol load information: Binary was not built with debug information.

    The module was loaded at the default load address.

    Ares2017.exe

    Symbol load information:

    C:\Users\altun.murat\Desktop\ares1-version19042019\ares1\ARESproject-vs2017\Debug\Ares2017.pdb: PDB does not match image.
    C:\Users\altun.murat\Desktop\ares1-version19042019\ares1\ARESproject-vs2017\Debug\Ares2017.pdb: PDB does not match image.
    C:\Users\altun.murat\Desktop\ares1-version19042019\ares1\ARESproject-vs2017\Debug\Ares2017.pdb: PDB does not match image.
    C:\WINDOWS\Ares2017.pdb: Cannot find or open the PDB file.
    C:\WINDOWS\symbols\exe\Ares2017.pdb: Cannot find or open the PDB file.
    C:\WINDOWS\exe\Ares2017.pdb: Cannot find or open the PDB file.
    C:\Users\ALTUN~1.MUR\AppData\Local\Temp\SymbolCache\Ares2017.pdb\94144e9e9dfb410886cff36cb3776ca11\Ares2017.pdb: Cannot find or open the PDB file.
    C:\Users\ALTUN~1.MUR\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\Ares2017.pdb\94144e9e9dfb410886cff36cb3776ca11\Ares2017.pdb: Cannot find or open the PDB file.
    C:\Program Files (x86)\TEC-IT\TBarCode6\Ares2017.pdb: Cannot find or open the PDB file.
    https://msdl.microsoft.com/download/symbols: Skipped checking location. The symbol file was not found in this location before.

    Output

    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp_win.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ucrtbase.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\combase.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp140d.dll'

    Thank you very much

    Altun Murat  

    Monday, May 6, 2019 7:20 AM
  • Hello,

    >>TBarCode6.ocx 
    Symbol load information: Binary was not built with debug information.
    The module was loaded at the default load address.

    I suggest you refer to this link to learn more about how to use TBarCode6 OCX, and if you are using it on Win 10, maybe think about using TBarCode11, since TBarCode6 is a little old. Since TBarCode6 is a third-party library,  I think you could post the issue on the Support forum of TBarCode.

    Best Wishes,

    Jack Zhang


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 6, 2019 9:27 AM
    Moderator
  • So I thought TBarCode6.ocx was very old that used the project in Visual Studio 2003 on a Windows XP x86 operating system, now I'm trying to migrate to Visual Studio 2017 on the Windows 10 x64 operating system. I installed TBarcode11, but the same errors. I have sent mail to 'support@tec-it.com', hope to help me.
    How can I upload these files?

    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\mfc140d.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\rpcrt4.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp140d.dll'

    Monday, May 6, 2019 12:10 PM
  • Hello,

    >>'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\mfc140d.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\rpcrt4.dll'
    'Ares2017.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp140d.dll' 

    Actually, you can ignore those message, unless you're hoping to step into the code for those dlls with the debugger (which is doubtful, as those are system dlls). In other words, you can and should ignore them, as you won't have the PDB files for any of those dlls (by default at least, it turns out you can actually obtain them when debugging via the Microsoft Symbol Server). All it means is that when you set a breakpoint and are stepping through the code, you won't be able to step into any of those dlls (which you wouldn't want to do anyways). For more details, I suggest you refer to this link

    Best Wishes,

    Jack



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Altun Murat Tuesday, May 7, 2019 6:24 AM
    • Unmarked as answer by Altun Murat Tuesday, May 7, 2019 6:53 AM
    • Marked as answer by Altun Murat Tuesday, May 7, 2019 6:53 AM
    • Unmarked as answer by Altun Murat Tuesday, May 7, 2019 6:53 AM
    Tuesday, May 7, 2019 2:39 AM
    Moderator
  • Hi
    I understand your message and read the formula you referred to, which is interesting is that every time I give it Local Windows Debugger does not load other * .dll files.

    Breakpoints - appcore.cpp

    ASSERT(AfxGetThread() == NULL);

    ASSERT(afxCurrentWinApp == NULL); // only one CWinApp object please

    Breakpoints - filex.cpp

    THROW(new CFileException(cause, lOsError, lpszFileName));mfc140d.dll!AfxThrowFIleException(int cause=2, long IOsError=2, const char *lpszFileName=0x00x900e0) Line117

    Breakpoints - filecore.cpp

    ASSERT(m_hFile != INVALID_HANDLE_VALUE);

    mfc140d.dll!CFile::Read(void*IpBuf=0x00b3f7c4, unsigned int nCount=260) Line 302

    The last indication in this issue is:

    I notified that Both CAres and CAresB have the gAres object. Have you tried to remove one?
    like this:

    // CAresB gAres; // remove the CAresB project 

    or 

    // CAres gAres;  // remove the CAresB project

    Thanks a lot for support.

    Murat Altun

    Tuesday, May 7, 2019 7:34 AM
  • //CAres gAres; //VBN

    //CAresB gAres; //VBN

    //#define TCBBAT(nombre) BOOL CAresB::InitInstance(){m_pMainWnd=new CMarcosB();CTcbBat::InitInstance(nombre);return TRUE;} //VBN

    //#define TCBAPL(nombre) BOOL CAres::InitInstance(){m_pMainWnd=new CMarcos();CTcbApp::InitInstance(nombre,true);return TRUE;} //VBN

    //#define TCBAPL(nombre) BOOL CAres::InitInstance(){m_pMainWnd=new CMarcos();CTcbApp::InitInstance(nombre);return TRUE;} //VBN 

    /*class CAresB : public CTcbBat
    {
    private:
    virtual BOOL InitInstance();
    };*/
    /*class CAres : public CTcbApp
    {
    private:
    virtual BOOL InitInstance();
    };*/

    //extern CAres gAres; //VBN

    Tuesday, May 7, 2019 8:36 AM
  • It's possible a library used by my DLL was linking statically to Boost.Thread and causing this issue, presumably due to a runtime mismatch. Changing the library to link dynamically to Boost can fixed the problem?
    Monday, May 20, 2019 12:10 PM
  • Hello,

    >>It's possible a library used by my DLL was linking statically to Boost.Thread and causing this issue, presumably due to a runtime mismatch. Changing the library to link dynamically to Boost can fixed the problem?

    Have a look at this, if you are accessing MFC Objects form Non-MFC Threads, I suggest you refer to this link

    Best Wishes,

    Jack Zhang


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 21, 2019 9:28 AM
    Moderator
  • Thanks a lot for the instructions, I read the links I received, I think I have to put mfc140d.dll statically to get it from the program not from VS2017 / Win10, I have tried different variants but I did not succeed. The program runs on Win XP x32 / VS2003.
    Thursday, May 23, 2019 6:23 AM
  • Hello

    I've studied the links you've sent, I've been trying to implement what they are saying, but it does not work: 

    #define BOOST_THREAD_DISABLED_DLL_CALLBACK 1 
    #include <boost/thread.hpp>.

    I tried the ideas of [Thread] Solution to conflict with MFC?

    I don't know what else can I try, do you have any ideas? 

    Tuesday, June 18, 2019 12:56 PM
  • Hello,

    Before you add these codes to the stdafx.cpp of the MFC Dll, did you remove the code:

    extern BOOL (WINAPI * const _pRawDllMain)(HANDLE, DWORD, LPVOID)=&dll_callback;

    of C:\local\boost_1_70_0\libs\thread\src\win32\tss_pe.cpp file and rebuild the boost thread lib?

    Best Wishes,

    Jack Zhang


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 20, 2019 7:49 AM
    Moderator
  • Hello
    In the stdafx.cpp file I have no code line.
    I removed the code line you told me from tss_pe.cpp (C: \ ares1-version14052019 \ ares1 \ ARESproject-vs2017 \ boost_1_69_0 \ libs \ thread \ src \ win32 \ tss_pe.cpp) and compiled again gave the error LNK1104 can not open file C: \ ares1-version14052019 \ ares1 \ ARESproject-vs2017 \ Debug \ Ares2017.exe
    Thursday, June 20, 2019 1:46 PM
  • Hello

    Now I have this error:

    Invalid object name 'TCB_Planin'.

    The cursor was not declared.

    SELECT * FROM TCB_Planin WHERE BeSTADO=0 AND bPlanin=2 AND fTareas<=SYSDATE ORDER BY fTareas, iPlanin

    Can you give me an idea how I can solve this error. Thank you.

    Wednesday, July 24, 2019 12:10 PM