// CFlNTsysApp.cpp : Defines the class behaviors for the application.
//

#pragma warning( disable : 4996 )
//#include <windows.h>
#include "stdafx.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


class CFlNTsysApp : public CWinApp
{
public:
	CFlNTsysApp();
  virtual BOOL InitInstance();

	protected:
	//{{AFX_VIRTUAL(CFlNTsysApp)
	//virtual BOOL xInitInstance();
	//}}AFX_VIRTUAL

	//{{AFX_MSG(CFlNTsysApp)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
// The one and only CDlgTestApp object
CFlNTsysApp theApp;

/////////////////////////////////////////////////////////////////////////////
// The one and only FactoryLink object
NTFlTask theFlTask( TASK_NAME, TASK_DESC);


BEGIN_MESSAGE_MAP(CFlNTsysApp, CWinApp)
	//{{AFX_MSG_MAP(CFlNTsysApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFlNTsysApp construction

CFlNTsysApp::CFlNTsysApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// CDlgTestApp initialization

BOOL CFlNTsysApp::InitInstance()
{


//	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	//Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	//Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

//	CDialog dlg;
//	m_pMainWnd = &dlg;

/*	CDlgTestDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.*/

  //Settings will be stored in the registry
  CExecImageVersion MyVersion;
  SetRegistryKey( MyVersion.GetLegalTrademarks());


  return TRUE;

  //initialise the FactoryLink part of the task
//  if (theFlTask.Init() == GOOD)
//  {

    //keep running untill we close down
//    while (theFlTask.Run( theFlTask.GetRunMode()) == GOOD)
//      ;

    //do our things to clean up and do it now...
    //don't wait till the object is deleted
    //theFlTask.Exit();

    //this is the part to shutdown the system
//    theFlTask.ShutdownSystem();
//  }

//	return FALSE;
}

/*
int main( int argc, char *argv[ ], char *envp[ ] )
{

}
*/


/*

// FlNTsys.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "FlNTsys.h"
#include "NTFlTask.h"
#include "DLGTEST.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;

using namespace std;

/////////////////////////////////////////////////////////////////////////////
// The one and only FactoryLink object
NTFlTask theFlTask( TASK_NAME, TASK_DESC);

//////////////////////////////////////////////////////////////////////
// int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
// 
// Main procedure for application
//////////////////////////////////////////////////////////////////////
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{

	int nRetCode = 0;


	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		
//		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		nRetCode = 1;
	}
	else
	{


    //initialise the FactoryLink part of the task
    if (theFlTask.Init() == GOOD)
    {

      //keep running untill we close down
//      while (theFlTask.Run( theFlTask.GetRunMode()) == GOOD)
//        ;

      //do our things to clean up
//      theFlTask.Exit();

      //this is the part to shutdown the system
//      theFlTask.ShutdownSystem();
    }
//    else nRetCode = -1;
	}

  //end of application, tell OS how we did
	return nRetCode;
}
*/

/////////////////////////////////////////////////////////////////////////////
// The one and only FactoryLink object
//NTFlTask theFlTask( TASK_NAME, TASK_DESC);

//////////////////////////////////////////////////////////////////////
// int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
// 
// Main procedure for application
//////////////////////////////////////////////////////////////////////
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{

	int nRetCode = 0;


	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		
		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		return (nRetCode = -1);
	}

  theApp.InitInstance();

  //this is our FactoryLink body
	{
  
    //initialise the FactoryLink part of the task
    if (theFlTask.Init() == GOOD)
    {

      //keep running untill we close down
      while (theFlTask.Run( theFlTask.GetRunMode()) == GOOD)
        ;

      //do our things to clean up
      theFlTask.Exit();
    }
    else nRetCode = -1;
	}

  //end of application, tell OS how we did
	return nRetCode;
}

